Subject:
How do I extract data from MATLAB figures?
Problem Description:
I have a few MATLAB figures, but no MATLAB code associated with it. I want to extract the data from the curves in the figures.
Solution:
Below is a step by step example to extract data from the curve in a MATLAB figure :
Assume that the figure is stored in a file called 'example.fig'. <step 1> Open the figure file:
<step 2> Get a handle to the current figure:
<step 3> The data that is plotted is usually a 'child' of the Axes object. The axes objects are themselves children of the figure. You can go down their hierarchy as follows:
<step 4> Extract values from the dataObjs of your choice. You can check their type by typing:
* NOTE : Different objects like 'Line' and 'Surface' will store data differently. Based on the 'Type', you can search the documentation for how each type stores its data. <step 5> Lines of code similar to the following would be required to bring the data to MATLAB Workspace: xdata = get(dataObjs, 'XData'); |
No comments:
Post a Comment