strCentroid

Return the centroid of a set of strings

Contents

Syntax

Description

strCentroid(cellStr) returns the string that has the shortest overall distance to all the other strings based on edit distance. The returned string must be one of the strings in cellStr.

Example

cellStr={'abcd', 'abde', 'abc', 'asdf', 'abd', 'abcd', 'abd'};
opt=strCentroid('defaultOpt');
outStr=strCentroid(cellStr, opt);
fprintf('The centroid of %s is %s.\n', cell2str(cellStr), outStr);
The centroid of {'abcd', 'abde', 'abc', 'asdf', 'abd', 'abcd', 'abd'} is abd.

See Also

editDistance, lcs.


Top page   Next: srcTrain.m   Prev:svmcEval.m