MATLAB Answers


choose points lie near a line on a surface plot

Asked by Huayan Wang on 20 Feb 2018
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?


Sign in to comment.

0 Answers