Function control with reference to GUI
Ältere Kommentare anzeigen
Hé Matlabbers,
I was struggling in Matlab and still can't solve this problem.
I have a M-File where I create this to uicontrols in a GUI.
edXi = uicontrol(ph,'Style','edit',...
'String','0',...
'Position',[200 52 100 20]);
edYi = uicontrol(ph,'Style','edit',...
'String','0',...
'Position',[150 52 100 20]);
pbLock = uicontrol(ph,'Style','togglebutton','String','Lock',...
'Units','normalized','Callback',@lock_call,...
'Position',[.1 .80 .4 .15]);
When someone press the togglebutton, the function below (written in a different m file) has to be executed. Only how do I give the reference of the 'edit' uicontrol to the function to change the string in the 'Edits' within the function?
function lock_call(hObject,eventdata)
set(edXi,'String',num2str(pos(1)));
set(edYi,'String',num2str(pos(2)));
end
Antworten (1)
Michael ten Den
am 20 Mai 2012
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!