Clear Filters
Clear Filters

Extract large set of data from Matlab plots in a excel Sheet in a particular format

2 views (last 30 days)
I am trying to get all the data out of the below plot. I have been able to extract the data for each X and Y axis, But I need to automate the process. I appreciate any comment. So what I need is data from each of the configuarion such as 288.10 and save then in a matrix in matlab and print a excel file , with four columns XR-X axis, XR-Y axis, XI-X axis, XI-Y axis. I am looking to get one excel sheet for each of the set. That means 2888.10, 288.100, 288.340 .... and so on. The .fig file is too large to share. I am sharing a jpeg image.
  1 Comment
dpb on 19 Jul 2022
Pretty straightforward presuming it is just a normal plotted set of lines and wasn't from one of the fancy toolbox specialty plots -- and doesn't look like would have been.
Kinda' tedious, but not difficult --caution -- air code, untested, just the outline of what to do programmatically ---
hF=openfig('yourfigure.fig'); % handle to the figure
hAx=findobj(hF,'type','Axes'); % and to the axes object
hLg=findobj(hF,'type','Legend'); % then the legend also child of figure
hL=findobj(hAx,'type','Line'); % and then the lines
Now just iterate over the line handles -- if legend was used,then
will return the legend string.
It's not clear the annotation was done with legend, though, with the disparate locations unless there are two axes; one for each set of plots overlaid over each other.
There's too much ambiguous about how the plot was done to write precise code...moral--save the data when drawing the figures! :)

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!