Hi. I have two MATLAB figures and I want to combine them together, meaning to show them on one plot. These two figures have two y-axes. Unfortunately, the code I am using combines only the figures based on the right Y-axes. Can someone help me with this. I am attaching the fig files.
Dir = 'D:\Original_Plots\';prefix1='plot_1';prefix2='plot_2';BinSuffix={''}; % Text_followed by number ID
% Load figures
for j = 1:1:length(BinSuffix) h1(j) = openfig([Dir prefix1 BinSuffix{j} '.fig'],'reuse'); ax1(j) = gca; h1(j)endfor j = 1:1:length(BinSuffix) h2(j) = openfig([Dir prefix2 BinSuffix{j} '.fig'],'reuse'); ax2(j) = gca;end% Combine figures
for j = 1:1:length(BinSuffix) hf = figure(20); hold on; fig1 = get(ax1(j),'children'); fig2 = get(ax2(j),'children'); s = gca; copyobj(fig1,s); copyobj(fig2,s); end% AXES LABELS
xlabel('x1,x2');hold on;ylabel('y1'); % on left axis
hold on;ylabel('y2'); % on right axissavefig('2_plots');
Best Answer