I have five figure in .Fig extension which i am creating after plotting 5 rows from a dataset. Now i want to Join these 5 figure into one figure in vertical allignemnt

조회 수: 1 (최근 30일)
<<
>>
<<
>>

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 7일
for each .fig, use openfig() to open the figure and return a handle to it. For each of those handles, h(K)
h_line = findobj(h(K), 'type', 'line');
line_ax = ancestor(h_line, 'axes');
title_obj = get(line_ax, 'title');
titles{K} = get(title_obj, 'string');
xlab{K} = get(line_ax, 'xlabel');
ylab{K} = get(line_ax, 'ylabel');
xdata{K} = get(h_line, 'xdata');
ydata{K} = get(h_line, 'ydata');
Once you have all of those, you can create a new figure and
for K = 1 : 5
ax = subplot(5,1,K);
plot(xdata{K}, ydata{K});
title(titles{K});
xlabel(xlab{K});
ylabel(ylab{K});
end
You can extend this if you need the tick marks to be specifically copied instead of automatically generated, or need special font, and so on.
  댓글 수: 2
subhendu roy
subhendu roy 2016년 3월 8일
fig1 = open('1st electrode.fig');
fig1_ax = gca; %gets current axis and stores into handle fig1_ax
fig2 = open('2nd electrode.fig');
fig2_ax = gca;
fig3 = open('3rd electrode.fig');
fig3_ax = gca;
fig4 = open('4th electrode.fig');
fig4_ax = gca;
fig5 = open('5th electrode.fig');
fig5_ax = gca;
figure; % The new figure
P = subplot(1,5,1);
copyobj(get(fig1_ax,'children'),P)
P = subplot(1,5,2);
copyobj(get(fig2_ax,'children'),P)
P = subplot(1,5,3);
copyobj(get(fig3_ax,'children'),P)
P = subplot(1,5,4);
copyobj(get(fig4_ax,'children'),P)
P = subplot(1,5,5);
copyobj(get(fig5_ax,'children'),P)
But if there any possibility to add these figures without help of Subplot.because i want only one Yaxis and Xaxis
Walter Roberson
Walter Roberson 2016년 3월 8일
figfiles = {'1st electrode', '2nd electrode', '3rd electrode', '4th electrode', '5th electrode'};
for K = 1 : 5
h(K) = openfig( [figfiles{K} '.fig']);
h_line = findobj(h(K), 'type', 'line');
xdata{K} = get(h_line, 'xdata');
ydata{K} = get(h_line, 'ydata');
end
newfig = figure();
newax = axes('Parent', newfig);
xycell = [xdata(:), ydata(:)].';
line_handles = plot(xycell{:});
legend( line_handles, figfiles );

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by