Main Content

# Normalize Data

Center and scale data in the Live Editor

## Description

The Normalize Data task lets you interactively normalize data by choosing centering and scaling methods, such as z-score. The task automatically generates MATLAB® code for your live script.

Using this task, you can:

• Customize how to center and scale data in a workspace variable such as a table or timetable.

• Automatically visualize the input data compared to the normalized data.

• Output the centering and scaling values used to compute the normalization.

## Open the Task

To add the Normalize Data task to a live script in the MATLAB Live Editor:

• On the Live Editor tab, click Task and select the Normalize Data icon .

• In a code block in the live script, type a relevant keyword, such as normalize. Select Normalize Data from the suggested command completions.

## Parameters

This task operates on data of type single or double. The data can be contained in a vector or table variables.

When providing a table or timetable for the input data, specify All supported variables to normalize all variables with a supported type. To choose specific supported variables to normalize, select Specified variables and then select the variables individually.

Specify the method and related parameters for normalizing data using one of these options:

Method

Method Parameters

Description

Z-score

Standard deviation (default)

Center and scale to have mean 0 and standard deviation 1.

Median absolute deviation

Center and scale to have median 0 and median absolute deviation 1.

Norm

Positive numeric scalar (default is 2) or inf for infinity norm

Scale data by p-norm.

Range

Left and right range limits (default is 0 for left limit and 1 for right limit)

Rescale range of data to an interval of the form [a b], where a < b.

Median IQR

Center and scale data to have median 0 and interquartile range 1.

Center

Mean (default)

Center to have mean 0.

Median

Center to have median 0.

Numeric scalar

Shift center by specified numeric value.

From workspace

Shift center using values in a numeric array or in a table whose variable names match the specified table variables from the input data.

Scale

Standard deviation (default)

Scale data by standard deviation.

Median absolute deviation

Scale data by median absolute deviation.

First element

Scale data by first element of data.

Interquartile range

Scale data by interquartile range.

Numeric scalar (default is 1)

Scale data by dividing by a numeric value.

From workspace

Scale data using values in a numeric array or in a table whose variable names match the specified table variables from the input data.
Center and scaleBoth center and scale data using parameters from the Center and Scale methods above

expand all

## Version History

Introduced in R2021b

expand all

Behavior changed in R2022a