[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to dump plotted points to matrix form from figure window? [SOLVE
From: |
Guido Walter Pettinari |
Subject: |
Re: How to dump plotted points to matrix form from figure window? [SOLVED] |
Date: |
Mon, 18 Jan 2010 13:07:02 +0000 |
It definetely does!
Thank you very much Ben!
Cheers,
Guido
On 18 Jan 2010, at 13:00, Ben Abbott wrote:
>
> On Jan 18, 2010, at 6:42 AM, Guido Walter Pettinari wrote:
>
>> Hello world!
>>
>> I have a function that produces a plot. I would like to dump the plotted
>> points in matrix form without having to modify the function itself.
>>
>> For example, imagine that my function is:
>>> function plot_square ( n )
>>> x = [1:n];
>>> plot ( x, x.*x )
>>> endfunction
>> and imagine that I cannot modify it. If I run the function I get a figure;
>> how can I dump to a matrix the plotted points (that is x and x.*x) directly
>> from the figure?
>>
>> Thanks,
>>
>> Guido
>
> Does this do what you want?
>
> h = findobj (gcf, "type", "line");
> x = get (h, "xdata");
> y = get (h, "ydata");
>
> Ben
>
>
>
>