MATLAB: How I can obtain the data points from a figure file

datapointsfigure

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.

Best Answer

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')