S = sum(A) returns the sum of the elements of A along the first array dimension whose size does not equal 1.- If
Ais a vector, thensum(A)returns the sum of the elements. - If
Ais a matrix, thensum(A)returns a row vector containing the sum of each column. - If
Ais a multidimensional array, thensum(A)operates along the first array dimension whose size does not equal 1, treating the elements as vectors. This dimension becomes1while the sizes of all other dimensions remain the same.
S = sum(A,dim) returns the sum along dimension dim. For example, if A is a matrix, then sum(A,2) is a column vector containing the sum of each row.S = sum(___,outtype) returns the sum with a specified data type, using any of the input arguments in the previous syntaxes. outtype can be 'default','double', or 'native'.S = sum(___,nanflag) specifies whether to include or omit NaN values from the calculation for any of the previous syntaxes. sum(A,'includenan') includes all NaNvalues in the calculation while sum(A,'omitnan') ignores them.
No comments:
Post a Comment