Products & Services Solutions Academia Support User Community Company

Learn more about Bioinformatics Toolbox   

sum (DataMatrix) - Return sum of elements in DataMatrix object

Syntax

S = sum(DMObj)
S = sum(DMObj, Dim)
S = sum(DMObj, Dim, IgnoreNaN)

Arguments

DMObj

DataMatrix object, such as created by DataMatrix (object constructor).

Dim

Scalar specifying the dimension of DMObj to calculate the sums. Choices are:

  • 1 — Default. Returns sum of elements in each column.

  • 2 — Returns sum of elements in each row.

IgnoreNaN

Specifies if NaNs should be ignored. Choices are true (default) or false.

Return Values

S

Either of the following:

  • Row vector containing the sums of the elements in each column in DMObj (when Dim = 1)

  • Column vector containing the sums of the elements in each row in DMObj (when Dim = 2)

Description

S = sum(DMObj) returns the sum of the elements in the columns of a DataMatrix object, treating NaNs as missing values. 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) returns the sum of the elements in the columns or rows of a DataMatrix object, as specified by 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) specifies if NaNs should be ignored. IgnoreNaN can be true (default) or false.

See Also

Bioinformatics Toolbox function: DataMatrix (object constructor)

Bioinformatics Toolbox object: DataMatrix object

Bioinformatics Toolbox methods of a DataMatrix object: max, min

  


Free Computational Biology Interactive Kit

See how to analyze, visualize, and model biological data and systems using MathWorks products.

Get free kit

Trials Available

Try the latest computational biology products.

Get trial software
 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS