Hi,
I am unable to reproduce the code given on the help page for the mean() function, https://www.mathworks.com/help/matlab/ref/mean.html
Here is the code I'm trying to run (I have version R2018a installed)
A(:,:,1) = [2 4; -2 1];A(:,:,2) = [9 13; -5 7];A(:,:,3) = [4 4; 8 -3];M1 = mean(A,[1 2])
I keep getting the error:
Error using sum
Dimension argument must be a positive integer scalar within indexing range.
Error in mean (line 116)
y = sum(x, dim, flag) ./ size(x,dim);
I'm not sure why this is happening since this is the code given by the Matlab people, so it should work. Could someone help me with this please? Thanks.
Best Answer