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.

mean2

Average or mean of matrix elements

Syntax

B = mean2(A)
gpuarrayB = mean2(gpuarrayA)

Description

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

gpuarrayB = mean2(gpuarrayA) computes the mean of the values in gpuarrayA, performing the operation on a GPU. This syntax requires the Parallel Computing Toolbox™.

Class Support

The input image A can be numeric or logical. The output image B is a scalar of class double.

The input image gpuarrayA is a gpuArray whose underlying class is numeric or logical. The output image gpuarrayB is a gpuArray scalar with the underlying class double.

Examples

collapse all

Read an image into the workspace.

I = imread('liftingbody.png');

Compute the mean.

meanval = mean2(I)
meanval = 140.2991

Extended Capabilities

See Also

| | | |

Introduced before R2006a

Was this topic helpful?