MATLAB: How to average the number of nearest points with voronoi

voronoi

I have a voronoi diagram and I would like to know how many are the vertices of each cell in the diagram (the average of all points actually), how can I find out?
x = [27,85,64,18,59,21,14,51,87,4,490,576,557,590,572,515,552];
y = [12,12,54,72,112,119,167,152,175,139,102,80,409,404,503,545,142];
voronoi(x,y)
axis equal

Best Answer

[~,C] = voronoin([x(:),y(:)]);
numVertices=cellfun('length',C);
mean(numVertices) %the result