I am using matlab R2012a to compute the column sum of a matrix using a sum() function. But I am getting either an incorrect answer or an error as show below:
>> A = ones(4,8)
A =
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
>> sum (A)
ans =
9 9 9 9 9 9 9 9
9 9 9 9 9 9 9 9
9 9 9 9 9 9 9 9
9 9 9 9 9 9 9 9
sum (A,2) Index exceeds matrix dimensions.
I have also tried the sum() function on matlab 2014 version and it gives a correct output there. So is this problem only related to 2012 version of matlab or am I missing something obvious?