Patch - Not enough input arguments
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to create a rectangle where the sides all have different colors. I found another question asking about this, but the answer there didn't seem to work. This is the code I'm trying to run:
X = [0,1,1,0];
Y = [0,0,2,2];
C = [1,0,0;0,1,0;0,0,1;1,1,0];
patch(X,Y,'FaceVertexCData',C,'EdgeColor','flat','FaceColor','none','LineWidth',2)
Yet I always get this error message:
Error using patch
Not enough input arguments.
I don't understand what inputs are missing here. How do I fix this?
0 Kommentare
Antworten (1)
Geoff Hayes
am 21 Apr. 2019
Axel - from patch you need to either provide a C the polygon colour specified as a scalar, vector, matrix, or a color name which may be the C you are passing in for the FaceVertextCData propery (though you may observe another error if you try to use this C for the polygon colour). Or you can just do
patch('XData', X, 'YData', Y, 'FaceVertexCData',C,'EdgeColor','flat','FaceColor','none','LineWidth',2)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Polygons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!