Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How to extract data points from a plot (can't use 'ginput')
Replies: 6   Last Post: Jan 31, 2013 5:26 AM

 Messages: [ Previous | Next ]
 Ansuman Mahapatra Posts: 7 Registered: 6/30/12
Re: How to extract data points from a plot (can't use 'ginput')
Posted: Jan 31, 2013 5:26 AM

"Forrest" wrote in message <g8upee\$f4g\$1@fred.mathworks.com>...
> Thanks Steve. I just figured it out. Below is what I did
> for those (like me) who are not very Matlab savy.
>
> First you must open the figure.
>
> openfig('fig1.fig'); %opens the figure
>
> h = findobj(gca, 'Type', 'line'); %gca gets 'handle'
> %of the open figure
> %h now has a value of 160.0106, not sure why but don't care
>
> get(h) %displays a list of all the 'tags', one of
> %which is XData and YData, which contain the
> %plot data
>
> X = get(h, 'XData');
> Y = get(h, 'YData');
>
> Done!

Thanks a lot for the information.

But X & Y are of dimension 1x1001 with range 0 to 720 as I have ploted my curve. But I want to know the value of Y at the discrete interval like [1,2,3,...,720]. But the code X = get(h, 'XData'); gives me X= [1, 1.7, 2.3, ... , 720].

Can any body solve this problem?

Date Subject Author
8/25/08 Forrest
8/25/08 Steven Lord
8/25/08 Forrest
8/25/08 Steven Lord
8/25/08 Forrest
1/31/13 Ansuman Mahapatra
8/25/08 Walter Roberson