From: vila bernabe on
Hi,
I have a problem when I try to use patch. I have this warning:

Warning: Values in patch Faces must be in [1 : rows(Vertices)] - not rendering.

I have no idea how to solve it, please help!

thank you.
From: Jan Simon on
Dear Vila!

> I have a problem when I try to use patch. I have this warning:
>
> Warning: Values in patch Faces must be in [1 : rows(Vertices)] - not rendering.
>
> I have no idea how to solve it, please help!

Please show us the code! Otherwise it is impossible to understand or even solve your problem!

Jan
From: Steven Lord on

"vila bernabe" <jeviber(a)hotmail.com> wrote in message
news:houvcb$gq8$1(a)fred.mathworks.com...
> Hi,
> I have a problem when I try to use patch. I have this warning:
>
> Warning: Values in patch Faces must be in [1 : rows(Vertices)] - not
> rendering.
>
> I have no idea how to solve it, please help!
>
> thank you.
>

The documentation for the Faces property of a patch says:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/patch_props.html#Faces

"This property is the connection matrix specifying which vertices in the
Vertices property are connected. The Faces matrix defines m faces with up to
n vertices each. Each row designates the connections for a single face, and
the number of elements in that row that are not NaN defines the number of
vertices for that face."

Now if your patch has, for example, 10 vertices but one of your faces
indicates that it goes through the 11th vertex, the 2.5th vertex, or the 0th
vertex [remember, 1-based indexing] that doesn't make sense, does it?
That's the cause of the warning you saw. To fix it, figure out which
element(s) of your patch's Face property is(are) not a valid vertex number
(an integer value between 1 and the number of vertices, or NaN) and change
them.

You'd use NaN if you were padding a short row to be the same length as a
longer row, like if one of your faces was a triangle and another a square:

verts = [0 0 0; 1 0 0; 1 1 0; 0 1 0; 0.5 2 0];
faces = [1 2 3 4; 3 4 5 NaN];
patch('Vertices', verts, 'Faces', faces, 'FaceColor', 'w', 'EdgeColor',
'k');
axis([-1 2 -1 3]);
axis square

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ