Gui - Two plots in new figure - handles
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I created a gui, and I had two plots in my figure. To plot on each I was using plot(handles.NameofPlot1,x,y) and it was working fine. By changing basically the NameofPlot to the tag name of each of the plots I could plot on the one I wanted.
However, I would like to have the two plots in a different figure.
So I created a new figure (newFig.fig) which also automatically created a new .m file (newFig.m).
I put in there my two plots.
How can I plot on each? Or in other words, how can handle these two plots from my first .m file?
If I do fig=figure(newFig) and then plot(x,y) it will of course always plot on the same.
Can I have some help please?
Many thanks, Elias
0 comentarios
Respuestas (2)
Geoff Hayes
el 23 de Jun. de 2015
Elias - from your example, it sounds like you have two GUIs and you want to plot the data on each one (though it isn't clear to me why you need GUIs to do this when simple figures would suffice).
If you want to pass data between the two GUIs (so that you can plot on any axes of either GUI), then see http://www.mathworks.com/matlabcentral/answers/146215-pass-data-between-gui-s for an idea on how to accomplish this.
1 comentario
Walter Roberson
el 23 de Jun. de 2015
GUI and "figure" are identical in MATLAB. You can have multiple figures and you can have multiple axes per figure.
Walter Roberson
el 23 de Jun. de 2015
f1 = figure(); %you can add Unit and Position parameters
ax1 = axes('Parent', f1); %you can add Unit and Position parameters
f2 = figure(); %you can add Unit and Position parameters
ax2 = axes('Parent', f2); %you can add Unit and Position parameters
plot(ax1, rand(20,1), 'r');
plot(ax2, randperm(25), 'g');
Ver también
Categorías
Más información sobre Specifying Target for Graphics Output 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!