iscategorical

Tests whether a value is a categorical array.

Category: Language Fundamentals > Data Types

Syntax

tf = iscategorical(A)

Returns true for a categorical array.

Description

A cell array of text, even if it looks like categories, is not categorical until it is converted with categorical. The test looks at the class only, not at the contents.

Input arguments

A
Any value.

Output arguments

tf
Logical scalar.

Example

Cell vs categorical

iscategorical(categorical({'a', 'b'}))
iscategorical({'a', 'b'})
Output
ans = logical
   1
ans = logical
   0

See also

categorical iscategory categories isordinal class