function mnnd = meanNND2d (array)

% Finds the Mean Nearest Neighbor distance of an array.

[narray] = allNN2d(array); % generate the nn array with allNN2d.m

sum = 0;

for i = 1:length(array)
   sum = sum + narray(i,2);
end

mnnd = sum/length(array);