From: Yanju on
I was trying to use matlab command 'surf' to plot a matrix (app. 50*50). There are a lot of points with zero values and I do not want them to show up in the graph since it will give a wholly blue background for all of these zero values. I tried to replace all these zero values with NaN, but after this most of the values which are not NaNs also disappeared from the surf graph. Has anyone ever had any experience with this kind of problems? Thanks!
From: Steven Lord on

"Yanju " <chen.yanju(a)gmail.com> wrote in message
news:i1g35c$4v4$1(a)fred.mathworks.com...
>I was trying to use matlab command 'surf' to plot a matrix (app. 50*50).
>There are a lot of points with zero values and I do not want them to show
>up in the graph since it will give a wholly blue background for all of
>these zero values. I tried to replace all these zero values with NaN, but
>after this most of the values which are not NaNs also disappeared from the
>surf graph. Has anyone ever had any experience with this kind of problems?
>Thanks!

SURF needs to connect each point to its 4-connected neighbors. How should a
point be drawn if its 4 neighbors are all NaNs?

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Frédéric Bergeron on
"Yanju " <chen.yanju(a)gmail.com> wrote in message <i1g35c$4v4$1(a)fred.mathworks.com>...
> I was trying to use matlab command 'surf' to plot a matrix (app. 50*50). There are a lot of points with zero values and I do not want them to show up in the graph since it will give a wholly blue background for all of these zero values. I tried to replace all these zero values with NaN, but after this most of the values which are not NaNs also disappeared from the surf graph. Has anyone ever had any experience with this kind of problems? Thanks!

Hey,
I agree with the previous answer. To avoid that no-4-neighbors points disapears, you can maybe try to triangulate the surface instead of using rectangles, That's what I've done for my field-leveling GUI . See my second message at: http://www.mathworks.com/matlabcentral/newsreader/view_thread/286702#761958
Bye
Fred
 | 
Pages: 1
Prev: rotate/flip image
Next: Optimisation toolbox