What does mean(s(:)) do and the reason for using " : " for mean of a square matrix?
Show older comments
The working of the below mentioned and the reason for using " : " avg = mean(s(:));
Accepted Answer
More Answers (1)
(:) reshapes the array to a column vector, as described in
doc colon
This is done when taking the mean of a 2d image as a simple way to avoid having to do
mean( mean( s ) )
In the case of mean and some other functions there is a special builtin function
doc mean2
but I always use the colon notation personally.
1 Comment
SRAVAN KUMAR REDDY METTUPALLI
on 3 Sep 2017
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!