How can I plot multiple graphs from another m-file to GUI axes?

2 visualizzazioni (ultimi 30 giorni)
Hi,
How I call GUI axes from another m-file? I have multiple axes in the GUI.
Now I use code like this: fH = hgload('Simulator_gui.fig'); aH = findobj(fH,'Type','axes'); axes1 = findobj(aH, 'Tag', 'graph1'); ... and then plot graph from the right spot... plot(axes1,eff_rank, 'bo-', 'color', [ 18 65 145 ]/255, 'linewidth', 2 );
This works but hgload doubles the GUI window and it is not what I want. It should plot graphs to one GUI.
How can solve this problem? If you have a better solution to do this than code above, please let me know.
Br, Teemu

Risposta accettata

Varun Bhaskar
Varun Bhaskar il 26 Ago 2015
Hi Teemu,
Please follow the below workflow:
Include the following lines of code in the first file say plotting1.m
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
figure % new figure
plotyy(x,y1,x,y2)
Leave the figure open. Do not clear the above variables after you run plotting1.m.
Now include the following lines of code in a different file called plotting2.m
x = 0:0.01:20;
y1 = 500*exp(-0.75*x).*sin(x);
y2 = 09*exp(-0.75*x).*sin(10*x);
hold on
plotyy(x,y1,x,y2)
As shown above, on running the above script the curve is plotted on the same figure that was used in plotting1.m.
You can use this workflow to suit your use case.

Più risposte (0)

Categorie

Scopri di più su Discrete Data Plots in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by