Esta página aún no se ha traducido para esta versión. Puede ver la versión más reciente de esta página en inglés.
categorical
es un tipo de dato que se utiliza para almacenar datos con valores provenientes de un conjunto finito de categorías discretas. Estas categorías pueden tener un orden natural, pero esto no es obligatorio. Un arreglo categórico ofrece un almacenamiento eficiente y una manipulación conveniente de datos no numéricos, a la vez que mantiene nombres significativos para los valores. Es posible utilizar arreglos categóricos en una tabla para seleccionar grupos de filas. Para obtener más información, consulte Create Categorical Arrays o vea Tablas y arreglos categóricos.
categorical | Array that contains values assigned to categories |
iscategorical | Determine whether input is categorical array |
discretize | Group data into bins or categories |
categories | Categories of categorical array |
iscategory | Test for categorical array categories |
isordinal | Determine whether input is ordinal categorical array |
isprotected | Determine whether categories of categorical array are protected |
addcats | Add categories to categorical array |
mergecats | Merge categories in categorical array |
removecats | Remove categories from categorical array |
renamecats | Rename categories in categorical array |
reordercats | Reorder categories in categorical array |
setcats | Set categories in categorical array |
summary | Print summary of table, timetable, or categorical array |
countcats | Count occurrences of categorical array elements by category |
isundefined | Find undefined elements in categorical array |
This example shows how to create a categorical array.
Convert Text in Table Variables to Categorical
This example shows how to convert a variable in a table from a cell array of character vectors to a categorical array.
Compare Categorical Array Elements
Use relational operations with a categorical array.
Use concatenation to combine categorical arrays.
Combine Categorical Arrays Using Multiplication
Use multiplication to combine categorical arrays, including ordinal categorical arrays and arrays with undefined elements.
Plot data from a categorical array.
Access Data Using Categorical Arrays
Search, select, and delete elements from categorical arrays.
Work with Protected Categorical Arrays
This example shows how to work with a categorical array with protected categories.
Advantages of Using Categorical Arrays
Categorical arrays provide a natural representation of data, mathematical ordering of character vectors, and efficient memory usage.
Ordinal categorical arrays have a mathematical ordering
to their categories. Use an ordinal categorical array if you want
to use the functions min
, max
,
or relational operations, such as greater than and less than.
Core Functions Supporting Categorical Arrays
Many functions in MATLAB® operate on categorical arrays in much the same way that they operate on other arrays. A few of these functions might exhibit special behavior when operating on a categorical array.