If your list of points are ordered of the boundary of the polygonal, you can detect if the list of points self intersect thus NOT represent a valid polygonal by using polyshape, catch the warning or get the number of regions, if it's larger than 1 it's not valid:
EDIT: you can also use ISSIMPLIFIED function
>> x=rand(1,5)
x =
0.1419 0.4218 0.9157 0.7922 0.9595
>> y=rand(1,5)
y =
0.6557 0.0357 0.8491 0.9340 0.6787
>> issimplified(polyshape(x,y,'Simplify',false))
ans =
logical
0
Best Answer