Actualizar handles dentro de un uipushtool y ClickedCallback

2 次查看(过去 30 天)
Buenas tardes amigos.
El motivo de mi pregunta es para saber si alguien de ustedes sabe actualizar el handles que se ha pasado como parámetro a una función handles desde un objeto uipushtool en su evento ClickedCallback.
function plotSin(hObject, handles)
cmP=10;
cnP=10;
fh = figure;
tbh = uitoolbar(fh);
uipushtool(tbh,'CData',imread('Complementos\Rojo.png'),'Separator','off',...
'TooltipString','Your toggle tool',...
'HandleVisibility','off',...
'ClickedCallback',...
{@marcarPunto,handles, cmP,cnP});
function marcarPunto(hObject,event,handles,cmP,cnP)
[handles.pnSin(cnP,cmP),handles.pmSin(cnP,cmP)]=ginputc(1, 'Color', 'w');
guidata(hObject,handles);
Tomando en consideración que dentro de la estructura handles tengo las matrices pnSin, pmSin.
El problema es que no logro actualizar el handles que entra como parámetro en la función principal (plotSin) cuando el handles llega a la función marcarPuntos,.
Gracias por su ayuda.

回答(1 个)

Walter Roberson
Walter Roberson 2016-10-23
[handles.pnSin(cnP,cmP),handles.pmSin(cnP,cmP)]=ginputc(1, 'Color', 'w');
is saving both outputs of ginputc() to the same place, which will result in handles.pmSin(cnP,cmP) holding only the y value. Is that what you want?

类别

Help CenterFile Exchange 中查找有关 NaNs 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by