質問

I have a rather large MATLAB script that I now need to create a GUI for.

I have several figure plots named figure(1), figure(2) etc already in a script and I now want to place all of these figures in the GUI menu.

I want to create a G.U.I for data in a script I already have written. When I go to file>new>GUI it creates a blank GUI in a separate script. I want to concatenate everything together so I can work on my G.U.I design within the same script or work with the G.U.I script such that it calls my figure names/variables etc for the main script i've been working on already.

I don't need a push button or a controller, I just need these figures to be displayed automatically upon GUI initialisation. Here is an example of the figures i'd like to include in the single G.U.I window:

enter image description here

役に立ちましたか?

解決

I didn't really understand your question, but this what I thought you want to do, see if it helps:

% two random data
dat1 = rand(1,10);
dat2 = rand(1,10);

fig = figure('MenuBar','None');
Plots = uimenu(fig, 'Label', 'Plots'); % Menu
% Its Submenus
uimenu(Plots, 'Label', 'Plot 1', 'Callback', @(~,~) plot(dat1, 'r'));
uimenu(Plots, 'Label', 'Plot 2', 'Callback', @(~,~) plot(dat2, 'b'));

enter image description here

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top