Transfer data from a figure to variable

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

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 6 日
編集済み: Azzi Abdelmalek 2012 年 9 月 7 日

1 投票

open axes proprieties of your figure,then click "more proprieties"
  1. select the second plot then click "more proprieties" you will find your data in xdata and ydata
  2. do the same to the third plot
be sur that you select the plot (not only the box)
x=get(gco,'XData');y=get(gco,'YData');

5 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 6 日
I will search how to do it by line command
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 6 日
% to transfer your data
clck on figure properties, then select your plot and go to Matlab command
x=get(gco,'XData');y=get(gco,'YData');
Néstor Monedero
Néstor Monedero 2012 年 10 月 27 日
Hi Azzi, i click on figure properties and select the average transfer function that i obtain with averaged spectrum analyzer. I don't find XData or YData clicking in more properties. I use Matlab 2011. I need to save the points x (frequency) and y (gain) in a vector to work with this then.
Thanks. Néstor
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 27 日
Néstor, be sur to click on the plot, not just on the windows, you will see your points highlighted. when you are done go to matlab command and write
x=get(gco,'XData');y=get(gco,'YData');
Néstor Monedero
Néstor Monedero 2012 年 10 月 27 日
Thanks Azzi.

サインインしてコメントする。

その他の回答 (1 件)

Robert Cumming
Robert Cumming 2012 年 9 月 7 日

0 投票

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 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 7 日
his figure contains 3 plots (subplot(3,1,i)). he must select one
Robert Cumming
Robert Cumming 2012 年 9 月 7 日
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
Azzi Abdelmalek 2012 年 9 月 7 日
It was said in his question. that's what "averaging spectrum analyzer" do
Robert Cumming
Robert Cumming 2012 年 9 月 7 日
Ok - I've never used that so wouldn't know... You learn something new everyday :)

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by