extracting data series from *.fig file
이전 댓글 표시
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
shubham kumar gupta
2022년 9월 10일
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
채택된 답변
추가 답변 (3개)
Petr
2011년 3월 10일
편집: Walter Roberson
2015년 9월 19일
댓글 수: 4
Paulo Silva
2011년 3월 10일
It looks like you got more things inside it than I was expecting, please do
D=get(gca,'Children'); get(D)
that will allow you to see what's there in the command line
Paulo Silva
2011년 3월 10일
D=get(gca,'Children'); Child=get(D)
Now explore the Child struct and see what's inside, to get values from there is just similar to the code I gave you.
Joseph
2015년 9월 19일
편집: Walter Roberson
2015년 9월 19일
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
2015년 9월 19일
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.
shubham kumar gupta
2022년 9월 10일
1 개 추천
댓글 수: 1
John Mikhail
2023년 7월 28일
Most convenient answer I've found by far
Petr
2011년 3월 10일
0 개 추천
댓글 수: 1
Walter Roberson
2011년 3월 10일
Probably not, hggroup are not uncommon for some kinds of plots. In future you could use findobj() to locate the objects that have xdata.
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
