how can results of two separate m files be plotted in same figure window
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
harsimran kaur
am 19 Nov. 2013
Beantwortet: Shivani Gupta
am 28 Mai 2019
figure window after execution of first program should not close. when second m file is executed result of second program should be plotted in first figure window
3 Kommentare
Walter Roberson
am 19 Nov. 2013
duplicates http://www.mathworks.co.uk/matlabcentral/answers/106709-how-can-results-of-two-separate-m-files-be-plotted-in-same-figure-window and should be merged with it.
Ashiq ali Ali
am 25 Jan. 2018
figure window after execution of first program should not close. when second m file is executed result of second program should be plotted in first figure window. Figures are not merging by this method . plz Suggest any other method ... ....
Akzeptierte Antwort
The Matlab Spot
am 19 Nov. 2013
Bearbeitet: The Matlab Spot
am 19 Nov. 2013
The following example functions plot in the current figure window with lines held on to the same axes.
- function test1 calling test2 is completely irrelevant in this context. they can be called seperately too.
- instead of using gca you can also pass the handle of axes or figure to the other function so that it use the same to plot
- if not super imposed, you can use the subplot function to plot multiple axes on a single figure window
e.g.
function test1()
plot(1:10);
hold on;
test2();
end
function test2()
plot(gca,2:20);
end
2 Kommentare
MOHD ABDUL MUQEEM
am 3 Aug. 2018
Hello! I want plot the same as the question asked but in my case the first program results are being cleared. So how can I plot two graphs in one if first .m file results are cleared from workspace. And if I remove clear all in the second .m file it is showing errors(second program is not executing) Please tell me how can i plot,isthere any solution?
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!