I'm trying to make a GUI with two pushbuttons. After one button is pushed, I want to change the text on both pushbuttons. I've figured out how to change the text on the pushbutton that was clicked, but not the other one. This is my code:
function rainbowr1=uicontrol('Style',... 'pushbutton',... 'String','Option 1',... 'Position',[10 350 100 30],... 'HandleVisibility','on',... 'Callback',@pushbutton_Callback);r2=uicontrol('Style','pushbutton',... 'String','Option 2',... 'Position',[10 250 100 30],... 'HandleVisibility','on',... 'Callback',@pushbutton_Callback);endfunction pushbutton_Callback(hObject,callbackdata,handles) disp(hObject.String) hObject.String='Option 3';end
I tried putting handles.r1.String='Option 4' within the callback, but that didn't do anything.
Best Answer