You can extract the numeric data from a “.fig” file by reopening it in MATLAB, finding the line objects, and saving their “XData” and “YData” to a “.csv”. To illustrate the process, I have first created a sample figure and saved it as “.fig”, reopened it and exported the data.
Step 1: Create and save a “.fig” file
y1 = 70 + 10*sin(0.1*x) + randn(size(x));
y2 = 80 + 15*exp(-0.02*(x-25).^2);
y3 = 90 + 5*randn(size(x));
plot(x, y1, 'm-s','LineWidth',1.5); hold on
plot(x, y2, 'y-^','LineWidth',1.5);
plot(x, y3, 'b-d','LineWidth',1.5);
title('Dummy Multi-Line Figure');
legend('Series 1','Series 2','Series 3','Location','best');
savefig('dummy_figure.fig');
This gives you a “.fig” file similar to the one in your screenshot.
Step 2: Open the “.fig” and export its data to “.csv”
fig = openfig('dummy_figure.fig','invisible');
hLines = findall(fig, 'Type', 'Line');
numLines = numel(hLines);
maxLen = max(arrayfun(@(h) numel(h.XData), hLines));
data = NaN(maxLen, numLines*2);
data(1:numel(x),(2*k-1)) = x;
data(1:numel(y),(2*k)) = y;
csvwrite('extracted_data.csv', data);
This way you can easily pull out the raw line data from any “.fig” file and save it for use in “.csv” format.
You may refer to documentation links for the functions used in the above implementation: