Gui - Two plots in new figure - handles
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Geoff Hayes
2015 年 6 月 23 日
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 件のコメント
Walter Roberson
2015 年 6 月 23 日
GUI and "figure" are identical in MATLAB. You can have multiple figures and you can have multiple axes per figure.
Walter Roberson
2015 年 6 月 23 日
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');
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!