How to pass parameters computed in different functions separately into another function?
Ältere Kommentare anzeigen
Hello,
I have three uicontrol popupmenus and I am supposed to select one item from all popupmenus. Each time I select an item, the appropriate Callback function computes a value (same parameter). After selecting the three items from all three different popupmenus, I press a pushbutton to compute another value (some parameter) which is computed by using the parameters from the previously selected items. here is how it looks like:
Selection1 = uicontrol('Style','popupmenu',...
'String',{'Selection1 ';'Selection2 ';'Selection3'},...
'Callback',@Selection1_Callback);
Selection2 = uicontrol('Style','popupmenu',...
'String',{'Selection4 ';'Selection5 ';'Selection6'},...
'Callback',@Selection2_Callback);
Selection3 = uicontrol('Style','popupmenu',...
'String',{'Selection7';'Selection8';'Selection9'},...
'Callback',@Selection3_Callback);
pushbutton = uicontrol('Style', 'pushbutton',...
'String', 'Compute', ...
'Callback' @pushbutton_Callback);
edit = uicontrol('Style', 'edit',...
'String', '');
function Selection1_Callback (hObject, eventdata, handles)
here I compute parameter 1
end
function Selection2_Callback (hObject, eventdata, handles)
here I compute parameter 2
end
function Selection3_Callback (hObject, eventdata, handles)
here I compute parameter 3
end
function pushbutton_Callback (hObject, eventdata, handles)
here I use parameters 1, 2, 3 in order to compute parameter 4
set(edit, 'String', Parameter4);
end
So how I can pass parameters 1, 2, and 3 into the pushbutton_Callback function so I could compute parameter 4 and then show it in edit box?
Thank you,
Aleksandar
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu App Building finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!