How can I extract data from a plot which was made with software + a recording device.
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
0 votes
a camera was used to video record a process and software turned it into a plot on matlab. I now want to extract the points on the plot but there are about 4500 points. Is there some kind of code i could just type in and it will return the X,Y values from the plot as a matrix or something so i can copy and process the data in excel. thanks
Accepted Answer
Walter Roberson
on 4 Mar 2018
Look in the File Exchange for the tag "digitize"
It is, however, always more accurate if you can get the original data instead of having to work on the plot of the data.
8 Comments
Walter Roberson
on 4 Mar 2018
Edited: Walter Roberson
on 4 Mar 2018
You have not given enough information about what the plot consists of. Is it lines? Is it an image? Is it a bar plot? Is it a contour plot? Are there multiple axes? Is it required to extract information from the legends and colorbars ?
Quewin Bridger
on 4 Mar 2018
Edited: Walter Roberson
on 4 Mar 2018
update: i tried the code in the accept answer suggested in this thread https://www.mathworks.com/matlabcentral/answers/100687-how-do-i-extract-data-from-matlab-figures and i get an error saying
"Error using get
Conversion to double from cell is not possible."
any ideas?
The plot is of height vs time. So a standard 2D plot with varying "height" on the y axis. I am able to extract data points using ginput but cant get 4500 data points like that.
Walter Roberson
on 4 Mar 2018
That error suggests to me that you have multiple line objects on the plot.
Perhaps you should zip the .fig and attach that here for us to examine.
Quewin Bridger
on 4 Mar 2018
i have attached the figure, thanks
Provided that you do not have any other images displayed at the time,
data = get(findobj(0, 'type', 'image'),'CData');
This will be a 145 x 4861 array of values each in the range 0 to 1.
Quewin Bridger
on 5 Mar 2018
this works. im just struggling to understand / work back to my actual X values which are much larger values than the ones that range from 0 - 1. For example i want to evaluate the graph at a time of 4000s and see what the height is at that point but cannot do that. Any further tips? thanks for all the help so far.
The .fig file has no record of what the original data range was.
data4000 = data(:,4000);
[max4000, max4000idx] = max(data4000);
Quewin Bridger
on 5 Mar 2018
thanks so much.
More Answers (0)
Categories
Find more on Data Exploration in Help Center and File Exchange
See Also
on 4 Mar 2018
on 5 Mar 2018
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)