我希望将对象转换为多边形,但出现以下错误。此外,当我绘制它们时,我会看到差异。如何将对象(例如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)