Extracting data from a .fig file
77 次查看(过去 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!