Extracting data from a .fig file
77 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Wissem-Eddine KHATLA
le 23 Nov 2023
Commenté : Dyuman Joshi
le 23 Nov 2023
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 commentaires
Réponse acceptée
Dyuman Joshi
le 23 Nov 2023
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 commentaires
Dyuman Joshi
le 23 Nov 2023
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!