how I can obtain the data points from a figure file?

1 view (last 30 days)
I know the answer when we have just one curve , but in my case they are two separate curve . So using this >> H = findobj(f, 'type', 'line'); >> x_data = get (H, 'xdata'); >> y_data = get (H, 'ydata'); give me all the y points together I want y points of each curve seperately.

Accepted Answer

Star Strider
Star Strider on 9 Aug 2014
The H value should be a (2x1) vector. Each handle will give you the x and y data for each curve:
H = findobj(f, 'type','line')
x1data = get(H(1),'XData')
x2data = get(H(2),'XData')
y1data = get(H(1),'ydata')
y2data = get(H(2),'ydata')
  3 Comments
mahdie
mahdie on 10 Aug 2014
There are so many data points in the figure, but they are few in x1 and x2 .
Star Strider
Star Strider on 10 Aug 2014
I don’t have your figure, so the best I can do is to simulate it with my own data. That worked for me.
Without your figure to work with, we can only guess what you want.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!