MATLAB: Combine three or more MATLAB figures

combine two figurescombine two matlab figures

Hello, I am new to MATLAB. I have three MATLAB figures. I want to combine them to compare the data. Can someone help me doing this?

Best Answer

I would save figures then plot them as subplots like this:
%First Figure
h1 = openfig('test1.fig','reuse'); % open figure
ax1 = gca; % get handle to axes of figure
%Second Figure
h2 = openfig('test2.fig','reuse');
ax2 = gca;
h3 = figure; %create new figure
s1 = subplot(1,2,1); %create and get handle to the subplot axes
s2 = subplot(1,2,2);
fig1 = get(ax1,'children'); %get handle to all the children in the figure
fig2 = get(ax2,'children');
copyobj(fig1,s1); %copy children to new parent axes i.e. the subplot axes
copyobj(fig2,s2);
Related Question