From: Ahmed on
this is the code i wrote to add, substract, multiple or divide two number
-----------------------------------------------------------------------------------------------------
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
-----------------------------------------------------------------------------------------------------------
it gives me
Undefined function or variable 'pushbutton_callback'
Error while evaluating uicontrol Callback

please, tell me how to correct it
From: Matt Fig on
"Ahmed " <worldmember(a)yahoo.com> wrote in message
> it gives me
> Undefined function or variable 'pushbutton_callback'
> Error while evaluating uicontrol Callback
>
> please, tell me how to correct it

Make that:


uicontrol('style','pushbutton','string',...
'press here to get the answer','callback',@pushbutton_callback,...
'position',[30,28,200,50]);

You might want to have a look at the documentation for UICONTROL properties.