grp2idx
Create index vector from grouping variable.
📝Syntax
[g, gN] = grp2idx(s)
[g, gN, gL] = grp2idx(s)
📄Description

grp2idx converts a grouping variable to numeric group indices.

gN is a cell array of group names. gL contains the group levels in a type matching the input when possible. Missing group values produce NaN indices.

💡Examples
s = {'red', 'blue', 'red', ''};
[g, gN, gL] = grp2idx(s)
🔗See Also
grpstatstabulatecrosstab
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub