Transfer data from a figure to variable
Afficher commentaires plus anciens
Hi,
I'm using Matlab Simulink to simulate the behavior of a electric circuit.
I obtain the average transfer function by using "averaging spectrum analyzer" block. What i need to do is to obtain the data of this average transfer function. I mean, i want to obtain in a vector x the range of frequency and in a vector y the range of gain.
How can i do it?
Thanks in advanced, Néstor
Réponse acceptée
Plus de réponses (1)
Robert Cumming
le 7 Sep 2012
to do it without interacting with the mouse at all you can get to the data through the children of the axes handle: e.g.
figure;
plot ( magic(10) );
axes_children = get ( gca, 'children' );
axes_lines = findobj ( axes_children, 'type', 'line' );
xdata = get ( axes_lines, 'xdata' )
ydata = get ( axes_lines, 'ydata' )
4 commentaires
Azzi Abdelmalek
le 7 Sep 2012
his figure contains 3 plots (subplot(3,1,i)). he must select one
Robert Cumming
le 7 Sep 2012
Where does it say that?
Anyway theory still remains true - the plot data can be obtained automatically through the axes(or sub axes...) handle and the children of the axes....
Azzi Abdelmalek
le 7 Sep 2012
It was said in his question. that's what "averaging spectrum analyzer" do
Robert Cumming
le 7 Sep 2012
Ok - I've never used that so wouldn't know... You learn something new everyday :)
Catégories
En savoir plus sur Simulink dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!