According to the example in the documentation for 'voronoin', the first point of v will always be [Inf, Inf]. Here's a quote:
The first row of V is a point at infinity. If any index in a cell of
the cell array is 1, then the corresponding Voronoi cell contains the
first point in V, a point at infinity. This means the Voronoi cell is
unbounded.
If you want to use 'polyarea' on the vertices v without getting NaNs then my naive answer is to chop off the first row of v before inputting it into 'polyarea':
sdata = [ 0.5 0
0 0.5
-0.5 -0.5
-0.2 -0.1
-0.1 0.1
0.1 -0.1
0.1 0.1 ]
[v , c] = voronoin(sdata);
for i = 1 : size(c ,1)
ind = c{i}';
tess_area(i,1) = polyarea( v(2:end,1), v(2:end,2))
end
But if that's not what you meant by "not working" then perhaps you can elaborate more on what you expected to see?