choose points lie near a line on a surface plot

1 view (last 30 days)
I have a meshgrid of [x y] = meshgrid(1:100,1:100); z could be any function of the x and y or some experimental data.
Then make a surface plot of z using surface(z). I want to draw a line on the surface with GUI and get the points lying on the line, if the line doesn't pass any points, find the points close to it instead. The imline only works on the image object. It gives me an error for the surface plot. The ginput cannot get the points either. Is there an easy way to do this?
I also want to choose an ROI on the surface plot. Something like the roipoly which returns a mask. But it seems this function only works on an image object. Is there a similar function on the surface plot or how can I convert the surface object to an image object?

Answers (0)

Community Treasure Hunt

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

Start Hunting!