No se como crear un 4x1 polyshape with 3 properties

2 次查看(过去 30 天)
Error using polyshape/checkInput
x- and y-coordinate vectors must both be numeric or both be cell arrays.
Error in polyshape (line 169)
[X, Y, tc, simpl, collinear] = polyshape.checkInput(param, varargin{:});
Error in untitled2 (line 19)
cborders=polyshape(cborders)

回答(1 个)

Steven Lord
Steven Lord 2024-6-13
What is the data type and size of the cborders variable used on line 19 of your untitled2.m file? You could add this command immediately before that line in your file to show us that information.
whos cborders
I suspect that line 19 is in a loop and that the first time through cborders contains data that polyshape can accept but the second time through it has been overwritten (on line 19) with a polyshape array and that's causing the code to not do what you expect. Try renaming the output variable on that line (and change the uses of cborders after that line to that same new name) and see if that resolves the error.
  4 个评论
VÍCTOR MANUEL CARANQUI SÁNCHEZ
Steven gracias tu respuesta pero no se puede crear con nsidepoly 4x1 polyshape with 3 properties, ya que es para crear figuras geométricas y el problema del que se trata es pata límites de paises, por eso se debe vcrear esta matriz
Steven Lord
Steven Lord 2024-6-17
I used nsidedpoly as a simple way to create polyshape objects. But if you have the coordinates of the boundaries of your countries, you could use those instead.
p1 = polyshape([0 0 1 3], [0 3 3 0]);
t = 0.05:0.5:2*pi;
x1 = cos(t);
y1 = sin(t);
x2 = 0.5*cos(t);
y2 = 0.5*sin(t);
p2 = polyshape({x1,x2},{y1,y2});
P = [p1; p2]
P =
2x1 polyshape array with properties: Vertices NumRegions NumHoles

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Elementary Polygons 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by