Given the fig file ( for example https://file.io/6Ud5sALJHi6e) how can I turn it into a ".mat" file ?
Asked
Active
Viewed 23 times
1 Answers
0
I cannot open the link but i am assuming you trying to ask how to get the data points in a figure to the matlab workspace. FOr this first you need to popen the figure and get figure handle. For example, create a simple figure
a = [1:8];
plot(a, 'bo-')
fig = gcf;
axObjs = fig.Children
dataObjs = axObjs.Children
For a line graph like this the x and y data points can be obtained from dataObjs
xaxis = dataObjs(1).XData
yaxis = dataObjs(1).YData
Then save the variables you want into a mat file
save('x_y.mat', 'xaxis', 'yaxis')
See more information here: https://kr.mathworks.com/matlabcentral/answers/100687-how-do-i-extract-data-from-matlab-figures

aase
- 13
- 4