>> X = [0 1 2
3 4 5]
>> sum(X, 1)
ans =
3 5 7
sum(X, 1)
should sum along the 1st
dimensio
I think that the Matlab documentation on this is quite clear. It states:
B = sum(A,dim) sums along the dimension of A specified by scalar dim. The dim input is an integer value from 1 to N, where N is the number of dimensions in A. Set dim to 1 to compute the sum of each column, 2 to sum rows, etc.
You're welcome to think that Matlab is wrong, but it ain't going to change !