I was using MATLAB to make several figures and I had saved them in the “.fig” format. A while later I misplaced the original data and I wanted to see if I could regain access to the data from the figure file. It took me a while and I had to dig pretty deep to find it but I finally found it and I’m posting it here to hopefully help you.
First click on your figure. Then go to the Matlab command line and type in the following commands.
line_handles = get(gca,'children')
x = get(line_handles(1),’xdata’);
%(1) is for first data line, (2) for second, etc.
y = get(line_handles(1),’ydata’);
And viola you’ve gotten your x and y data back from any of your line plots on that figure. If you have subplots it works as well just be sure to click on the subplot plot that you want to get the data on before you enter the commands above.