Combine fig files into 1 figure

51 ビュー (過去 30 日間)
Mak
Mak 2020 年 5 月 5 日
コメント済み: Abdullah Türk 2020 年 7 月 14 日
Hi,
I have 3 fig files and want to combine them into 1 figure (see picture uploaded)
I have tried with subplots but did not work.
This is my code, and my fig files are also attached:
figure
subplot(3,1,1)
openfig('SARIMA_forecast.fig'); % open figure
subplot(3,1,2)
openfig('VAR_forecast.fig'); % open figure
subplot(3,1,3)
openfig('VECM_forecast.fig'); % open figure

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 5 日
編集済み: Ameer Hamza 2020 年 5 月 5 日
Run this code
fig(1) = openfig('SARIMA_forecast.fig'); % open figure
fig(2) = openfig('VAR_forecast.fig'); % open figure
fig(3) = openfig('VECM_forecast.fig'); % open figure
new_fig = figure;
ax_new = gobjects(size(fig));
for i=1:3
ax = subplot(3,1,i);
ax_old = findobj(fig(i), 'type', 'axes');
ax_new(i) = copyobj(ax_old, new_fig);
ax_new(i).YLimMode = 'manual';
ax_new(i).Position = ax.Position;
ax_new(i).Position(4) = ax_new(i).Position(4)-0.02;
delete(ax);
end
  3 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 5 月 6 日
I am glad to be of help.
Abdullah Türk
Abdullah Türk 2020 年 7 月 14 日
Hi Hamza,
I have three fig file. I want to combine these files as a single fig file (as in the example above). I run your code but I did not.
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in Untitled (line 9)
ax_new(i) = copyobj(ax_old, new_fig);
Can you help me please?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by