I want to put fig files as subplots
4 views (last 30 days)
Show older comments
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);
0 Comments
Answers (1)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!