Hello,
I have two figures (.fig file). These both figures have 4 plots in them (2×2 layout). I got them from two different Simulink models and want to make visual comparison of each plot. I've tried this code but it just merges one plot and other three plot spaces are left empty. Can someone help me?
% Open old figures.
gu = open('1.fig'); gu_ax = gca; lu = open('2.fig'); lu_ax = gca; F = figure; % New figure
P1 = subplot(2,2,1); % Plot a subplot.
P1_pos = get(P1,'position'); % get its position.
delete(P1) % Delete the subplot
P2 = subplot(2,2,2); P2_pos = get(P2,'position'); delete(P2); P3 = subplot(2,2,3); P3_pos = get(P3,'position'); delete(P3); P4 = subplot(2,2,4); P4_pos = get(P4,'position'); delete(P4); P = copyobj(gu_ax,F); % Copy the gu_ax to new fig
set(P,'position',P4_pos) % Set its position to the deleted subplot's
P = copyobj(lu_ax,F); set(P,'position',P4_pos);
Best Answer