Main Content


Standard deviation of matrix elements



B = std2(A) computes the standard deviation of all values in array A.


collapse all

Read a grayscale image into the workspace, then calculate the standard deviation of the pixel intensity values.

I = imread('liftingbody.png');
val = std2(I)
val = 31.6897

Input Arguments

collapse all

Input data, specified as a numeric or logical array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Output Arguments

collapse all

Standard deviation of input data, returned as a numeric scalar. If the data type of A is single, then the data type of B is also single. Otherwise, the data type of B is double.

Data Types: single | double

Extended Capabilities

Version History

Introduced before R2006a

See Also

| | |