Extracting values from a plot
Extracting values from a plot
(OP)
Hi all,
Is there a way to extract values from a plot. I have created a plot in MATLAB and would like to extract the y-value for any given x-value along the x-axis. I have x and y data stored as arrays from a for-loop. However, if I want to extract the y value for x=0.225 (first value along the x-axis) I need to impose y(1) instead of y(0.225). Any thoughts?
Is there a way to extract values from a plot. I have created a plot in MATLAB and would like to extract the y-value for any given x-value along the x-axis. I have x and y data stored as arrays from a for-loop. However, if I want to extract the y value for x=0.225 (first value along the x-axis) I need to impose y(1) instead of y(0.225). Any thoughts?





RE: Extracting values from a plot
RE: Extracting values from a plot
y = x.^2;
h = plot(x,y)
px = get(h,'XData');
py = get(h,'YData');
inx = find(x == .225)
py(inx)