Extracting data from a .fig file
조회 수: 78 (최근 30일)
이전 댓글 표시
Hello everyone,
I know this has already been discussed in an another discussion but I want to extract data from a particular figures and I keep having an error while using the habitual procedure :
open('Comparaison R(t) EXP x THE.fig');
a = get(gca,'Children');
xdata = get(a, 'XData');
ydata = get(a, 'YData');
zdata = get(a, 'ZData');
I obtain the following error :
Error using matlab.graphics.primitive.Data/get
Unrecognized property XData for class ConstantLine.
Anyone knows how I can have access to these datas ?
Thanks for your help in advance,
Sincerely
댓글 수: 0
채택된 답변
Dyuman Joshi
2023년 11월 23일
There are multiple objects in the figure. You need to choose the object(s) for which you want to get the data -
open('Comparaison R(t) EXP x THE.fig')
a = get(gca,'Children')
%x, y and z data for the 2nd graphics object
x2 = a(2).XData
y2 = a(2).YData
z2 = a(2).ZData
댓글 수: 2
Dyuman Joshi
2023년 11월 23일
You're welcome!
Also, note that not every graphical object will have coordinate data associated with it.
A ConstantLine object is an example of that -
open('Comparaison R(t) EXP x THE.fig')
a = get(gca,'Children')
get(a(1))
%Though Get the axis and value associated with it
a(1).InterceptAxis
a(1).Value
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!