Matlab-将封闭的对象转换为2D多边形

时间:2018-07-03 07:14:28

标签: matlab

我希望将对象转换为多边形,但出现以下错误。此外,当我绘制它们时,我会看到差异。如何将对象(例如C.txt)转换为二维多边形?

Warning: Polyshape has duplicate vertices, intersections, or other inconsistencies that may produce inaccurate or unexpected results. Input data has
been modified to create a well-defined polyshape. 
> In polyshape/checkAndSimplify (line 339)
  In polyshape (line 152)
  In Untitled (line 8)

脚本:

dataFile = dlmread('E:\C.txt'); % file stored in https://ufile.io/km74t
uniqueTable = unique(dataFile,'rows')
dataTable = array2table(uniqueTable,'VariableNames',{'X','Y'})
xCord=dataTable{:,1};
yCord=dataTable{:,2};
scatter(xCord,yCord)
hold on;
pgon = polyshape(uniqueTable)
plot(pgon)

0 个答案:

没有答案