I want to put fig files as subplots

조회 수: 5 (최근 30일)
PIYUSH MOHANTY
PIYUSH MOHANTY 2019년 5월 14일
답변: Edward Rodriguez 2022년 7월 2일
I have four different .fig files, which I want to display in one figure with individual fig files as subplots. ALthough their xlimits are same, ylims are different.
Can you please figure out what is wrong with the following code?
h1 = openfig('PPT5.fig','reuse'); % open figure
ax1 = gca; % get handle to axes of figure
h2 = openfig('PPT14.fig','reuse');
ax2 = gca;
h3 = openfig('PPT2.fig','reuse'); % open figure
ax3 = gca; % get handle to axes of figure
h4 = openfig('ACC12.fig','reuse');
ax4 = gca;
% test1.fig and test2.fig are the names of the figure files which you would % like to copy into multiple subplots
h5 = figure; %create new figure
s1 = subplot(4,1,1); %create and get handle to the subplot axes
s2 = subplot(4,1,2);
s3 = subplot(4,1,3); %create and get handle to the subplot axes
s4 = subplot(4,1,4);
fig1 = get(ax1,'children'); %get handle to all the children in the figure
fig2 = get(ax2,'children');
fig3 = get(ax3,'children');
fig4 = get(ax4,'children');
copyobj(fig1,s1); %copy children to new parent axes i.e. the subplot axes
copyobj(fig2,s2);
copyobj(fig2,s3);
copyobj(fig2,s4);

답변 (1개)

Edward Rodriguez
Edward Rodriguez 2022년 7월 2일
nadie ayude, que tristeza

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by