sum
Return sum of elements in DataMatrix object
Syntax
S = sum(DMObj)
S = sum(DMObj, Dim)
S = sum(DMObj, Dim, IgnoreNaN)
Input Arguments
| DMObj | DataMatrix object, such as created by  | 
| Dim | Scalar specifying the dimension of  
 | 
| IgnoreNaN | Specifies if NaNs should be ignored. Choices are  | 
Output Arguments
| S | Either of the following: 
 | 
Description
S = sum(DMObj)S is a row vector
containing the sums of the elements in each column in DMObj.
If the values in DMObj are singles,
then S is a single;
otherwise, S is a double. 
S = sum(DMObj, Dim)Dim. If Dim = 1,
returns S, a row vector containing the
sums of the elements in each column in DMObj.
If Dim = 2, returns S,
a column vector containing the sums of the elements in each row in DMObj.
Default Dim = 1.
S = sum(DMObj, Dim, IgnoreNaN)IgnoreNaN can
be true (default) or false.
Version History
Introduced in R2008b
See Also
DataMatrix | max | min