Make a m file with the following code to get the x y data of the curve.
Get data from matlab figure.
Each of the cells will have three elements.
Note that the dot notion feature is available starting from matlab 2014b so instead of using the get function you may do the following.
As much as i like matlab figures i usually find excel features more desirable for good looking plots.
You ll get some other value depending on state of rng at the time but the process should be clear to retrieve the data from the plot and find a location.
So i needed to extract the data of curve fitting tool.
Select a web site.
Based on your location we recommend that you select.
Next we will learn how we can get our graph in the figure object.
The xdata information the ydata information and the name of the type of the object.
I think this is because every figure is structured slightly differently and people are posting solutions that work for a particular figure but don t generalize.
One can also step through the figure data in matlab by loading the figure using the command s load figure fig mat.
How to extract data if figure has two independent plots the above code is extracting data from one plot of the figure 0 comments.
Nb that if your x values are non integer values you may need to make the comparison fuzzy rather than exact as is shown here.
Show hide all comments.
Now xydatas will be a cell array with one entry for each object in the plot that has an xdata property.
Save the figure as a fig file.
In our example we will create a bar plot in the figure object.
To get the graph in a new window we first create the figure object as above and then write the syntax to create the desired plot.
Here is what i did.
The solutions using get never really worked for me.
Matlab by default assigns the plot to the latest figure object created.