Main Content

sumabs

Sum of absolute elements of matrix or matrices

Syntax

[s,n] = sumabs(x)

Description

[s,n] = sumabs(x) takes a matrix or cell array of matrices and returns,

s

Sum of all absolute finite values

n

Number of finite values

If x contains no finite values, the sum returned is 0.

Examples

m = sumabs([1 2;3 4])
[m,n] = sumabs({[1 2; NaN 4], [4 5; 2 3]})

Version History

Introduced in R2010b

See Also

| |