Main Content


(Not Recommended) Determine if levels are in nominal or ordinal array

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.


tf = islevel(levels,A) returns a logical array indicating which of the levels in levels correspond to a level in the nominal or ordinal array A.

Input Arguments

collapse all

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

Levels to test, specified as a character vector, string array, cell array of character vectors, or 2-D character matrix.

Data Types: char | string | cell

Output Arguments

collapse all

Level indicator, returned as a logical array of the same size as levels. tf has the value 1 (true) when the corresponding element of levels is the label of a level in the nominal or ordinal array A, even if the level contains no elements. Otherwise, tf has the value 0 (false).

Version History

Introduced in R2007a