I have a certain GUI built without GUIDE, just plain old uicontrols and I've gotten everything to work properly so far. However I want to, upon a button press grab the value in a text-box (edit) and store it into a variable fi.
Basically the code in question;
c2 = uicontrol(f,'Style', 'pushbutton','String','Rotation','Callback',
@rotation);
s1 = uicontrol(f,'Style', 'edit');
function rotation(src,event)
load 'BatMan.mat' X
fi = %This is the value I want to have the value as the edit box.
subplot(2,2,1)
PlotFigure(X)
end
Easiest is to get
rotation
to know abouts1
through an input argument:Here, we set the callback for
c2
to be an anonymous function with the right signature (2 input arguments), and which callsrotation
withs1
as an additional argument. The callback now has the handles1
embedded in it.