grp2idx - Grouping variable to index vector

Syntax

[G,GN] = grp2idx(group)

Description

[G,GN] = grp2idx(group) creates an index vector G from the grouping variable group. (See Grouped Data.) The variable group can be a categorical variable, a numeric vector, a character matrix (with each row representing a group name), or a cell array of strings stored as a column vector. The result G is a vector taking integer values from 1 up to the number of unique entries in group. GN is a cell array of names such that GN(G) reproduces s (with the exception of any differences in type).

See Also

gscatter, grpstats

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS