How can I plot multiple graphs from another m-file to GUI axes?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Varun Bhaskar
2015-8-26
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!