Patch - Not enough input arguments
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Geoff Hayes
le 21 Avr 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 commentaires
Voir également
Catégories
En savoir plus sur Polygons dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!