Hi,
I'm working on a GUI that will have the user type in a number and select A or B from a popup menu, then click a pushbutton to output the values and use them in the main script. Here is what I have so far:
function [out1,out2]=menuf = figure('Position',[350 350 500 300]);x = uicontrol('Style', 'edit',... 'String', {''},... 'Position', [100 250 100 50]);y = uicontrol('Style', 'popup',... 'String', {'A','B'},... 'Position', [100 170 100 50]);z = uicontrol('Style', 'pushbutton',... 'String', {'OK'},... 'Position', [100 100 100 50],... 'Callback', 'uiresume(gcbf)')uiwait(f)out1=get(x,'String')out2=get(y,'Value')close(f)end
There are 2 things I need help with:
1. Currently this returns out1 and out2 in the command window, but the function output seems to only save "ans" in my workspace which is a 1×1 cell. How can I get it to return a 1×2 or 2×1 with both my out1 and out2 values?
2. How can I use the values in the main script? I think if I can get the ans matrix to to return both values then I can assign ans{1} and ans{2} in my script. But if I'm trying to use out1 and out2 they don't save in my script's workspace, for which I've tried toying with assignin to no avail.
Thanks for your time!
Best Answer