Refer to the attached image. I want to display the image in Matlab using the function
surf(). However, I only want to display the region of the actual object without the background (the pale-green region surrounding the actual object which has 0 value). How to do that? I tried replacing all the outer region with
NaN and setting all the values in the height map to a nonzero value, but still I get an error message:
Subscript indices must either be real positive integers or logicals.
So how can I display a surface that has a non-rectangular boundary?