Main Content

setlabels

(Not Recommended) Assign labels to levels of nominal or ordinal arrays

The nominal and ordinal array data types are not recommended. To represent ordered and unordered discrete, nonnumeric data, use the Categorical Arrays data type instead.

Description

B = setlabels(A,labels) returns a nominal or ordinal array object of the same type as A, but with levels labeled in the order specified by labels.

B = setlabels(A,labels,levels) labels only the levels specified in levels.

Input Arguments

collapse all

Nominal or ordinal array, specified as a nominal or ordinal array object created with nominal or ordinal.

Labels to assign to levels, specified as a string array, cell array of character vectors, or 2-D character matrix.

Data Types: char | string | cell

Level to assign labels to, specified as a string array, cell array of character vectors, or 2-D character matrix.

Data Types: char | string | cell

Output Arguments

collapse all

Nominal or ordinal array, returned as a nominal or ordinal array object.

Version History

Introduced in R2007a