필터 지우기
필터 지우기

Extract multiple data series from *.fig

조회 수: 7 (최근 30일)
Chern Hui Lee
Chern Hui Lee 2012년 12월 12일
답변: Emanuele Spinosa 2014년 10월 15일
Hi,
I have a .fig file from which I'd like to extract the original data. But the graph is a superposition of 2 plots, one being the original data, while the second one indicates the peaks of interest (just some circles that indicate the peaks).
When I try D = get(gca,'Children'); XData = get(D,'XData'); YData = get(D,'YData'); I get only the data of the second plot, i.e. the locations and values of the peaks. How can I extract the original data instead?
Thank you.

답변 (4개)

Jan
Jan 2012년 12월 12일
Are there mutliple axes objects?
findobj(get(gcf, 'Children'), 'type', 'axes')
Or are the handles of the 2nd line object hidden?
D = allchild(gca)

Emanuele Spinosa
Emanuele Spinosa 2014년 10월 14일
Hello,
I've got the same problem. Could you please tell me how you solved it?
Thanks
E.

Mikhail
Mikhail 2014년 10월 14일
1) get id of your axes:
a=get(gcf,'Children')
2) get data you needed:
y=(get(a(1),'Children'),'YData')
If there is multiple data on 1 axes (2 or more functions on 1 graph) u'll get cell array

Emanuele Spinosa
Emanuele Spinosa 2014년 10월 15일
I think the best thing to do is to open manually the fig, delete manually all the data we're not interested in and then use the code
open namefile.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
This will just extract the data you're interested in.

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by