I have a question which is an extension of a previous question: https://www.mathworks.com/matlabcentral/answers/525423-combine-two-matlab-figures-with-two-y-axes
I want to plot these four figures having secondary y-axis (attached) as sub-plots, in 2 rows and 2 columns. My code plots only one set of data from each figure. What are the corrections to the code below to make it work for secondary y-axes?
I have problem with the y-ticks, ylabels and ylimits. I have mentioned the details in the code below. I want the Ylim[0,2] for left y-axis and Ylim[0,5] for right y-axis.
Any help will be appreciated.
Dir = 'D:\Expt_Results\'prefix='plot_';BinSuffix=[1:4];% Load figures into handles
for j = 1:1:length(BinSuffix) h(j) = openfig([Dir prefix num2str(BinSuffix(j)) '.fig'],'reuse'); ax(j) = gca;end% Subplot loop
Fig_dim=[13 12];hf = figure('Units','inches','Position',[0 0 Fig_dim]);row_count = 0;sp_count = 0;no_rows=2;no_cols=2;for i = 1:length(BinSuffix) fig = get(ax(i),'children'); s(i) = subplot(no_rows,no_cols,i); copyobj(fig,s(i)); sp_count = sp_count + 1; sp(sp_count) = s(i);end
Best Answer