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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Akzeptierte Antwort
Walter Roberson
am 7 Mär. 2016
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 Kommentare
Walter Roberson
am 8 Mär. 2016
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 );
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!