How can I plot multiple matlab saved figures into one

I have 12 figures saved as Matlab figures format. I need to combine them into one for displaying but I cannot make it work. This is what I have been trying but the combined graphs are empty.
I am very new to Matlab and I cannot find any way of combining existing graphs into one. Thanks in advance for any help!
fh1 = open('short1.fig');
fh2 = open('long1.fig');
fh3 = open('short2.fig');
fh4 = open('long2.fig');
fh5 = open('short3.fig');
fh6 = open('long3.fig');
fh7 = open('short4.fig');
fh8 = open('long4.fig');
fh9 = open('short5.fig');
fh10 = open('long5.fig');
fh11 = open('short6.fig');
fh12 = open('long6.fig');
% Create plots
t = tiledlayout(6,2);
nexttile
fh1
nexttile
fh2
nexttile
fh3
nexttile
fh4
nexttile
fh5
nexttile
fh6
nexttile
fh7
nexttile
fh8
nexttile
fh9
nexttile
fh10
nexttile
fh11
nexttile
fh12

 採用された回答

Chris
Chris 2021 年 10 月 28 日
編集済み: Chris 2021 年 10 月 28 日

0 投票

I would recommend saving the data and then producing the images on the tiledlayout, but...
% Open the figures
open('short1.fig');
% Get a handle to the current axes
gh1 = gca;
open('short2.fig');
gh2 = gca;
% ...
% Create plots
figure
t = tiledlayout(6,2)
nexttile
% Copy plots from the axes into the current axes
copyobj(gh1.Children,gca)
% ...
Other parts of the figures, like legends and axis labels, will necessitate other commands

3 件のコメント

Chris
Chris 2021 年 10 月 28 日
Wow, you accepted that so quickly!
Please comment if you find these commands aren't sufficient for what you need.
Jorge Martinez Compains
Jorge Martinez Compains 2021 年 10 月 28 日
Thanks a lot! I saw a very similar post, but I thought children was not referring to a generic object.
Chris
Chris 2021 年 10 月 28 日
編集済み: Chris 2021 年 10 月 28 日
I see. Most graphics objects have "Children" and a "Parent," e.g:
Root -> Figure -> TiledChartLayout -> Axes -> Lines
Parent - - - > - - - > Children

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLabels and Annotations についてさらに検索

タグ

質問済み:

2021 年 10 月 28 日

編集済み:

2021 年 10 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by