function R = meanNnd3d(M); % Calculates the mean nearest neighbor distance of a 3d group, using the raw matrix as the input individual = allnnd3d(M); findmean = mean(individual(:,3)); R = findmean;