From 7:00 PM CST Friday, January 24th - 7:00 PM CST Sunday, January 26th, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

sum (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: basic

Requires: MathScript RT Module

Syntax

c = sum(a)

c = sum(a, b)

Description

Computes the sum of vectors and matrices.

Examples

Inputs

Name Description
a Specifies a vector or matrix of double-precision, floating-point or complex double-precision, floating-point numbers.
b Specifies the dimension along which to compute the sum. b accepts the following values.

1 (default) LabVIEW computes the sum of each column of a.
2 LabVIEW computes the sum of each row of a.

Outputs

Name Description
c Returns the sum of all elements in a if a is a vector. If a is a matrix, c returns the column-wise sums of the elements in a. c is a scalar or vector.

Details

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Yes

Examples

A = [1:1:15]
C = sum(A)

A = [1, 2, 3, 4; 5, 6, 7, 8; 9, 10, 11, 12]
sum(A, 1)
sum(A, 2)

Related Topics

accumproducts
accumsums
prod

WAS THIS ARTICLE HELPFUL?

Not Helpful