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
returns
the sum of the elements in the columns of a DataMatrix object, treating
NaNs as missing values. 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 single
s,
then S
is a single
;
otherwise, S
is a double
.
returns
the sum of the elements in the columns or rows of a DataMatrix object,
as specified by 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
.
specifies
if NaNs should be ignored. S
= sum(DMObj
, Dim
, IgnoreNaN
)IgnoreNaN
can
be true
(default) or false
.
Version History
Introduced in R2008b
See Also
DataMatrix
| max
| min