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)
0 个评论
回答(1 个)
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 个评论
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]
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!