How can I extract curve data from a .FIG file?

3 visualizaciones (últimos 30 días)
Keith Grey
Keith Grey el 8 de Jun. de 2020
Respondida: Tommy el 8 de Jun. de 2020
I have 10 .FIG files plotted using the segment below.
yyaxis left
plot(50:450, V1 * 10^6, 'r')
xlabel('Frequency (Hz)')
ylabel('S')
yyaxis right
plot(50:450, V2 * 10^6, '--r')
ylim([0 10])
ylabel('SS')
xlim([50 250])
ax = gca;
ax.YAxis(1).Color = 'k';
ax.YAxis(2).Color = 'k';
I want to take the **first curve from each figure & plot them on one figure.
% **The first curve is the yyaxis left portion (from above).
plot(50:450, V1 * 10^6, 'r')
xlabel('Frequency (Hz)')
ylabel('S')
Is there a way I can accomplish that? If so, could you outline the method or point me in the right direction with the documentation?
Thank you.

Respuestas (1)

Tommy
Tommy el 8 de Jun. de 2020
You could use findobj() on each figure to find the handles of the two lines. You can differentiate the lines by their LineStyles (maybe there's a better way to distinguish the two lines, but I couldn't come up with it). All together, something like this:
% for final product:
f = figure; ax = axes(f, 'NextPlot', 'add');
filenames = {'file1.fig', 'file2.fig', ..};
for i = 1:numel(filenames)
f1 = openfig(filenames{i}); % load the old figure
lh = findobj(f1, 'Type', 'Line', 'LineStyle', '-'); % find the line with '-' linestyle
copyobj(lh, ax); % copy that line to your new axes
delete(f1); % delete the old figure
end

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by