How can I plot multiple graphs from another m-file to GUI axes?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Teemu Juujärvi
el 24 de Ag. de 2015
Respondida: Varun Bhaskar
el 26 de Ag. de 2015
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
0 comentarios
Respuesta aceptada
Varun Bhaskar
el 26 de Ag. de 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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Discrete Data Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!