Plot already exisitng graphs onto one graph

2 ビュー (過去 30 日間)
Hadi
Hadi 2011 年 6 月 2 日
回答済み: Farhad Sedaghati 2015 年 7 月 17 日
I have two graphs generated by a code and now I want to use the code blow to plot them on a 2x1 figure. but the resulting figure, first doesn't show the graphs and second includes only one blank set of axes on top half of the page.
...................
fig1=openfig('firstpane')
fig2=openfig('secondpane')
subplot(211)
plot(fig1)
subplot(212)
plot(fig2)
..............
is there any easier way? I can't write a loop to generate the two figures at once because the code is quiet heavy and I'd get memory problem.
Thanks

採用された回答

Matt Fig
Matt Fig 2011 年 6 月 2 日
I assume that you have two saved MATLAB figures, firstpane.fig and secondpane.fig, each with one axes object.
fh = figure;
P = subplot(2,1,1);
P1 = get(P,'pos');
delete(P)
P = subplot(2,1,2);
P2 = get(P,'pos');
delete(P)
fig1 = openfig('firstpane');
C = copyobj(gca,fh);
set(C,'pos',P1)
close(fig1)
fig1 = openfig('secondpane');
C = copyobj(gca,fh);
set(C,'pos',P2)
close(fig1)

その他の回答 (1 件)

Farhad Sedaghati
Farhad Sedaghati 2015 年 7 月 17 日
This following function helps you to put several fig files next to each other as subplots: http://www.mathworks.com/matlabcentral/fileexchange/51236-subplot It is important to note that all the saved fig file should be 2D and single plot (No subplots)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by