vecCentroid
Return the centroid of a set of strings
Contents
Syntax
- [minId, distMat]=vecCentroid(cellVec, opt, showPlot)
Description
vecCentroid(cellVec) returns the index of the vector that has the shortest overall distance to all the other vectors based on linear scaling.
Example
cellVec={[2 3 6], [1 3 2 4 8], [5 4 3 7 8 9], [1 3 5 4 3 7 8 9], [5 6 1 3 5 4 3 7 8], [7 6 4 2 3 6], [7 5 8 2 3 2 3 6]};
opt=strCentroid('defaultOpt');
minId=vecCentroid(cellVec, opt, 1);
fprintf('The centroid is %s.\n', mat2str(cellVec{minId}));
The centroid is [2 3 6].