mean of elements of a matrix

5 views (last 30 days)
alpedhuez
alpedhuez on 31 Mar 2018
Answered: Image Analyst on 20 Jan 2023
I have a matrix A. I want to take an average of all elements of A. Please advise.

Accepted Answer

David Fletcher
David Fletcher on 31 Mar 2018
mean(A(:))
Gives the mean of the entire matrix

More Answers (2)

Rana Hamza
Rana Hamza on 20 Jan 2023
Take average as the mean of whole matrix

Image Analyst
Image Analyst on 20 Jan 2023
theAverage = mean(A, 'all')
% or
theAverage = mean2(A) % In the Image Processing Toolbox.

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!