Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Data Types

Grouping variables, categorical arrays, and dataset arrays

Statistics and Machine Learning Toolbox™ provides two additional data types. Work with ordered and unordered discrete, nonnumeric data using the nominal and ordinal data types. Store multiple variables, including those with different data types, into a single object using the dataset array data type. However, these data types are unique to Statistics and Machine Learning Toolbox. For greater cross-product compatibility, use the categorical or table data types, respectively, available in MATLAB®. For more information see Create Categorical Arrays (MATLAB), Create and Work with Tables (MATLAB), or watch Tables and Categorical Arrays.

Functions

nominalCreate nominal array
ordinalCreate ordinal array
dummyvarCreate dummy variables
gplotmatrixMatrix of scatter plots by group
grp2idxCreate index vector from grouping variable
gscatterScatter plot by group
mat2datasetConvert matrix to dataset array
cell2datasetConvert cell array to dataset array
struct2datasetConvert structure array to dataset array
table2datasetConvert table to dataset array
dataset2cellConvert dataset array to cell array
dataset2structConvert dataset array to structure
dataset2tableConvert dataset array to table
exportWrite dataset array to file
ismissingFind dataset array elements with missing values
joinMerge observations

Using Objects

nominalArrays for nominal data
ordinalArrays for ordinal data

Classes

datasetArrays for statistical data

Examples and How To

Categorical Arrays

Create Nominal and Ordinal Arrays

This example shows how to create nominal arrays using nominal.

Categorize Numeric Data

Categorize numeric data into a categorical ordinal array using ordinal.

Change Category Labels

Change the labels for category levels in categorical arrays using setlabels.

Add and Drop Category Levels

Add and drop levels from a categorical array.

Merge Category Levels

Merge categories in a categorical array using mergelevels.

Reorder Category Levels

This example shows how to reorder the category levels in an ordinal array using reorderlevels.

Sort Ordinal Arrays

Determine sorting order for ordinal arrays.

Plot Data Grouped by Category

Plot data grouped by the levels of a categorical variable.

Summary Statistics Grouped by Category

Compute summary statistics grouped by levels of a categorical variable.

Test Differences Between Category Means

Test for significant differences between category (group) means using a t-test, two-way ANOVA (analysis of variance), and ANOCOVA (analysis of covariance) analysis.

Regression with Categorical Covariates

Perform a regression with categorical covariates using categorical arrays and fitlm.

Index and Search Using Categorical Arrays

Index and search data by its category, or group.

Dataset Arrays

Create a Dataset Array from Workspace Variables

Create a dataset array from a numeric array or heterogeneous variables existing in the MATLAB workspace.

Create a Dataset Array from a File

Create a dataset array from the contents of a tab-delimited or a comma-separated text, or an Excel file.

Add and Delete Observations

Add and delete observations in a dataset array.

Add and Delete Variables

Add and delete variables in a dataset array.

Access Data in Dataset Array Variables

Work with dataset array variables and their data.

Select Subsets of Observations

Select an observation or subset of observations from a dataset array.

Sort Observations in Dataset Arrays

Sort observations (rows) in a dataset array using the command line.

Merge Dataset Arrays

Merge dataset arrays using join.

Stack or Unstack Dataset Arrays

Reformat dataset arrays using stack and unstack.

Clean Messy and Missing Data

Find, clean, and delete observations with missing data in a dataset array.

Calculations on Dataset Arrays

Perform calculations on dataset arrays, including averaging and summarizing with a grouping variable.

Export Dataset Arrays

Export a dataset array from the MATLAB workspace to a text or spreadsheet file.

Dataset Arrays in the Variables Editor

The MATLAB Variables editor provides a convenient interface for viewing, modifying, and plotting dataset arrays

Index and Search Dataset Arrays

Learn the many ways to index into dataset arrays.

Concepts

Categorical Arrays

Categorical Arrays

Categorical arrays store data that have a finite set of discrete levels, which might or might not have a natural order.

Advantages of Using Categorical Arrays

Easily manipulate category levels, carry out statistical analysis, and reduce memory requirements.

Grouping Variables

Grouping variables are utility variables used to group or categorize observations.

Dummy Indicator Variables

Dummy indicator variables let you adapt categorical data for use in regression analysis.

Dataset Arrays

Dataset Arrays

Dataset arrays store data with heterogeneous types.

Was this topic helpful?