help-octave
[Top][All Lists]

## Re: How to get the Z value of a point (X,Y) from surface plot?

 From: Doug Stewart Subject: Re: How to get the Z value of a point (X,Y) from surface plot? Date: Fri, 19 Jul 2019 17:21:15 -0400

On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <address@hidden> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.

But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.

try this

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

h=surf(A, B, C);
q=get(h)
q.zdata

--
DAS