Main Content

mean2

Average or mean of matrix elements

Description

B = mean2(A) computes the mean of all values in array A.

example

Examples

collapse all

Read an image into the workspace.

I = imread('liftingbody.png');

Compute the mean.

meanval = mean2(I)
meanval = 
140.2991

Input Arguments

collapse all

Input data, specified as a numerical or logical array.

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

Output Arguments

collapse all

Mean 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

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

Version History

Introduced before R2006a

See Also

| | |