Why does a single data point in a column of NaN not show up in a MESH plot?
1 view (last 30 days)
Show older comments
I am creating a MESH plot from a matrix of data values. In this matrix, the entire last column is made up of NaNs except for one point. When I do a MESH plot of this matrix, that point does not show up. An example code would be:
%
%
z = zeros(10);
z(:,10) = NaN;
z(5,10)=5;
mesh(z);
%%%
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This is an intended behavior of the MESH function. The MESH function creates four-sided polygons. Thus for a point to be displayed in a MESH plot, it needs to be associated with three other points to form a polygon.
In this case, the point in the last column of the above example cannot be associated with three other defined points to form a four-sided polygon. Hence this point is not displayed in the MESH plot.
In such cases, as a workaround, you can use the TRIMESH function.
0 Comments
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!