From: Ahmed on 13 Jul 2010 07:59 i want to make GUI using uicontrol that adds , subtracts , multiplies , divides two numbers , but it give me Undefined function or variable 'pushbutton_callback' Error while evaluating uicontrol Callback please correct it ---------------------------------------------------------------------------------------------------------------------- function process uicontrol('style','edit','string',... 'Enter first number','tag','first_number_tag',... 'position',[281,200,110,50]); uicontrol('style','popup','string',... {'select process','+','-','*','/'},'tag','process_tag',... 'position',[281,166,110,20]); uicontrol('style','edit','string',... 'Enter second number','tag','second_number_tag',... 'position',[280,99,110,50]); uicontrol('style','pushbutton','string',... 'press here to get the answer','callback','pushbutton_callback',... 'position',[30,28,200,50]); uicontrol('style','edit','string','0','tag','result_tag',... 'position',[281,28,110,50]); function pushbutton_callback first_number=str2double(get(handles.first_number_tag,'string')); process=get(handles.process_tag,'vaule'); second_number=str2double(get(handles.second_number_tag,'string')); switch process case 2 , result=first_number+second_number; case 3 , result=first_number-second_number; case 4 , result=first_number*second_number; case 5 , result=first_number/second_number; end result_str=num2str(result); set(result1_header,'string',result_str) end end
From: Steven Lord on 13 Jul 2010 09:31 "Ahmed " <worldmember(a)yahoo.com> wrote in message news:i1hke8$92u$1(a)fred.mathworks.com... >i want to make GUI using uicontrol that adds , subtracts , multiplies , >divides two numbers , but it give me Undefined function or variable >'pushbutton_callback' Error while evaluating uicontrol Callback please >correct it What happened when you tried the suggestion Matt gave you in your previous thread about this issue? *snip* http://www.mathworks.com/matlabcentral/newsreader/view_thread/286706#761953 If you didn't try it, TRY IT. If you did and it didn't work, explain IN THAT OTHER THREAD what happened (and be specific; don't say "it errored", say "It gave me this error that I've copied into this message.) -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: us on 13 Jul 2010 09:33 "Ahmed " <worldmember(a)yahoo.com> wrote in message <i1hke8$92u$1(a)fred.mathworks.com>... > i want to make GUI using uicontrol that adds , subtracts , multiplies , divides two numbers , but it give me > Undefined function or variable 'pushbutton_callback' > Error while evaluating uicontrol Callback > please correct it > > 'press here to get the answer','callback','pushbutton_callback',... > function pushbutton_callback two preliminary thoughts... % old 'press here to get the answer','callback','pushbutton_callback',... % new 'press here to get the answer','callback',@pushbutton_callback,... % old function pushbutton_callback % new function pushbutton_callback(h,e,varargin) % see also http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f10-998674.html us
From: Ahmed on 13 Jul 2010 11:30 i replaced : uicontrol('style','pushbutton','string',... 'press here to get the answer','callback','pushbutton_callback',... 'position',[30,28,200,50]); by : uicontrol('style','pushbutton','string',... 'press here to get the answer','callback',&pushbutton_callback,... 'position',[30,28,200,50]); it gave me : ??? Error using ==> process>pushbutton_callback Too many input arguments. ??? Error while evaluating uicontrol Callback then i also replaced : function pushbutton_callback by : function pushbutton_callback(h,e,varargin) it gave me : ??? The class "handles" is undefined. Perhaps Java is not running. Error in ==> process>pushbutton_callback at 34 first_number=str2double(get(handles.first_number_tag,'string')); ??? Error while evaluating uicontrol Callback
|
Pages: 1 Prev: Least squares with ill-conditioned mxn matrix Next: imaqregister - for current user only? |