I have looked and found some workarounds for this, but never an explanation why it doesn't work. The Matlab documnetation directly says "If you want to use true colors, then specify FaceVertexCData in one of these forms: ... For one color per face, use an m-by-3 array of RGB triplets, where m is the number of rows in the Faces property". I have an array of m-by-3 RGB values, but it still throws this error:
Warning: Error creating or updating Patch
Error in value of property FaceVertexCData
Number of colors must equal number of vertices or faces
When you click on the "FaceVertexCData", it brings you to the documentation where I pulled that excerpt from (Patch Properties > FaceVertexCData). So what gives? The documentation says I can individually color the faces, but it doesn't seem to let me. Also, I know the below code does not color faces differently. This is a minimal reproducible example, not may actual code. I would edit rows of the colors matrix to different colors to actually color them differently.
vertices = [0, 0, 0;
1, 0, 0;
1, 1, 0;
0, 1, 0;
0, 0, 1;
1, 0, 1;
1, 1, 1;
0, 1, 1];
[faces, volume] = convhull(vertices(:,1),vertices(:,2),vertices(:,3));
colors = repmat([0 0 1],size(faces,1),1);
disp(size(colors))
disp(size(faces))
figure('Name', 'Colored Differently');
trisurf(faces,vertices(:,1),vertices(:,2),vertices(:,3),colors,'EdgeColor',[0 0 1], 'DisplayName', 'Convex Hull')
figure('Name', 'Colored the Same');
trisurf(faces,vertices(:,1),vertices(:,2),vertices(:,3),'FaceColor',[0 1 0],'EdgeColor',[1 0 0], 'DisplayName', 'Convex Hull')