Main Content

isprotected

R2026b

Determine if categories of categorical array are protected

Description

tf = isprotected(A) returns logical 1 (true) if the categories of a categorical array are protected. Otherwise, isprotected returns logical 0 (false).

  • 1 (true) — When you assign new values to B, the values must belong to one of the existing categories. Therefore, you only can combine arrays that have the same categories. To add new categories to B, you must use the addcats function.

  • 0 (false) — When you assign new values to B, the categories update automatically. Therefore, you can combine (nonordinal) categorical arrays that have different categories. The categories can update to include the categories from both arrays.

example

Examples

Input Arguments

collapse all

Input array, specified as a categorical array.

The categories of ordinal categorical arrays are always protected.

Output Arguments

collapse all

True or false result, returned as a 1 or 0 of data type logical.

Extended Capabilities

expand all

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced in R2013b