extracting data series from *.fig file
201 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Petr
am 10 Mär. 2011
Kommentiert: John Mikhail
am 28 Jul. 2023
Hi there,
I have a figure file, but not the original data.
Is there a way to extract the data array from the 2D plot, opened from *.fig file?
Thanks in advance,
Petr.
1 Kommentar
shubham kumar gupta
am 10 Sep. 2022
many a time it may happen you really get confused by varying answers non of them working
So follow this
S = load('MyFigure.fig', '-mat');
Now open S and go to children -> children -> Properties
Now search for CData, or XData, YData & ZData
you can export these variables
Akzeptierte Antwort
Paulo Silva
am 10 Mär. 2011
open data.fig %open your fig file, data is the name I gave to my file
D=get(gca,'Children'); %get the handle of the line object
XData=get(D,'XData'); %get the x data
YData=get(D,'YData'); %get the y data
Data=[XData' YData']; %join the x and y data on one array nx2
%Data=[XData;YData]; %join the x and y data on one array 2xn
3 Kommentare
Weitere Antworten (3)
Petr
am 10 Mär. 2011
Bearbeitet: Walter Roberson
am 19 Sep. 2015
4 Kommentare
Joseph
am 19 Sep. 2015
Bearbeitet: Walter Roberson
am 19 Sep. 2015
This code generated an error:
openfig(figureFile);
D = get(gca,'Children');
Child = get(D);
??? Error using ==> get
Objects must all be instances of the same class.
Walter Roberson
am 19 Sep. 2015
hfig = openfig(figureFile);
d = findall(hfig, '-property', 'xdata');
xydatas = arrayfun(@(h) get(h, {'xdata','ydata', 'type'}), d, 'Uniform', 0);
Now xydatas will be a cell array with one entry for each object in the plot that has an xdata property. Each of the cells will have three elements: the xdata information, the ydata information, and the name of the type of the object. Different kinds of objects might be included, depending on what was drawn in the plot.
The original question is not precise about what kind of 2D plot is present. For example, lines, surfaces, patches, and scatter plots are all 2D plots that have xdata properties.
Petr
am 10 Mär. 2011
1 Kommentar
Walter Roberson
am 10 Mär. 2011
Probably not, hggroup are not uncommon for some kinds of plots. In future you could use findobj() to locate the objects that have xdata.
Siehe auch
Kategorien
Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!