Menu Gui - how to have the menu box always displayed
Show older comments
I have the following function:
function menu_plot_results(Data,Index)
option = menu('plot data',...
'Exit',...
'Close All',...
'aaaa',...
'bbbb',...
'cccc');
switch option
case 1 %Exit
case 2 %Close All
case 3 %aaaa
case 4 %bbbb
case 5 %cccc
end
cases 3-5 create plots of data. Once the figures are created, I would like the menu to re-appear, so that additional plots can be created.
Thanks
Chris
Accepted Answer
More Answers (2)
Sean de Wolski
on 29 Mar 2012
I'm not clear on this:
You have a menu, you have it generate a figure, but then it closes and you want it to stay open?
After the plot, just have it call itself again.
function mpr(Data,Index)
option = menu('plot data',...
'Exit',...
'Close All',...
'aaaa',...
'bbbb',...
'cccc');
switch option
case 1 %Exit
case 2 %Close All
close all
case 3 %aaaa
figure;
peaks;
mpr;
case 4 %bbbb
figure;
image;
mpr;
case 5 %cccc
figure;
membrane;
mpr;
end
Or, and this is the route I would take, don't use menu() just hard code your own GUI with a few UICONTROLS and then it doesn't have to close.
1 Comment
Matt Tearle
on 29 Mar 2012
I wondered about this... This is probably fine, but I don't like the recursiveness -- if you make 15 plots, you're actually 15 function calls deep, until you finally exit and they all collapse back out.
Chris
on 30 Mar 2012
0 votes
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!