'Multifaceted Patches with structs (matlab)

matlab newcomer here. I have a problem understanding how to use patch() using a structure with given vertices and faces. It is a simple problem and probably easily solved, but I guess I might need a little inspiration. I wrote the following example lines after reading through the patch-related Documentations I found:

Z = struct('VoV',[0 0 0; 0 1 0; 0 1 1; 0 0 1],'VoF',[1 2 3 4]);
patch(Z);

Instead of the wanted quadrangle I recieved the error:

Error using patch

Unrecognized property VoV for class Patch.

Any help would be very much appreciated :)



Solution 1:[1]

Pulling an example from the MATLAB help page for patch:

clear S
S.Vertices = [2 4; 2 8; 8 4; 5 0; 5 2; 8 0];
S.Faces = [1 2 3; 4 5 6];
S.FaceVertexCData = [0; 1];
S.FaceColor = 'flat';
S.EdgeColor = 'red';
S.LineWidth = 2;
figure
patch(S)

It looks like the field names you want are Vertices and 'Faces' not VoV and FoV.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GrapefruitIsAwesome