i am new in GUI and i want to write the simplest m-file using uicontrol command and the code should add or subtract or multiply or divide two numbers
so there are 3 edit text for first number and second number and result
and one popup list for the process and one push button as i enter the two numbers and push the push button and result occurs but it is wrong code so please how to correct it
%draw GUI and double click on each component
%make units : pixels and take position in pixels from each component
%distance from left , distance from bottom , width , height
function process2 %function m_file_name
first_number_header=uicontrol('style','edit','string',...
'Enter first number','position',[281,200,110,50]);
popup1_header=uicontrol('style','popup','string',...
{'select process','+','-','*','/'},'position',[281,166,110,20]);
%select process,+,-,*,/ : these are the labels that appear on it
second_number_header=uicontrol('style','edit','string',...
'Enter second number','position',[280,99,110,50]);
uicontrol('style','pushbutton','string',...
'press here to get the answer','position',[30,28,200,50],...
'callback','pushbutton1_callback');
result1_header=uicontrol('style','edit','string','result 1',...
'position',[281,28,110,50]);
first_number=str2double(get(first_number_source,'string'));
popup1=str2double(get(popup1_source,'string'));
second_number=str2double(get(second_number_source,'string'));
switch popup1
case 2 , result1=first_number+second_number;
case 3 , result1=first_number-second_number;
case 4 , result1=first_number*second_number;
case 5 , result1=first_number/second_number;
end
function pushbutton1_callback
set(result1_header,'string',result1)
end
end