I try make UI without GUIDE
I wrote simple code:
function testui()f=figure();f.Color='black';f.ToolBar='none';ui=uicontrol('Style','edit');ui.HorizontalAlignment='right';ui.String='0';myvar=2;pb=uicontrol('Style','pushbutton','Position',[250 20 60 20],'String', 'Evaluate', 'Callback',{@pushbutton_callback,myvar,ui.String})end function pushbutton_callback(hObject,callbackdata,x,Y) F=str2double(Y); display(F) display (x)end
The problem is that even if I enter in edit box some string (number< say 10 and click "Enter", which must change the handle ui.String), I do not get this number in pushbutton_callback function. I get only predefined ui.String (if not empty): F = 0 x = 2 Instead of F = 10 x = 2 as expected. What do I wrong?
[EDITED, Jan. Please format your code – Thanks!]
Best Answer