Sum2D
Advanced Analysis Library Only
AnalysisLibErrType Sum2D (void *inputArray, ssize_t numberOfRows, ssize_t numberOfColumns, double *sum);
Purpose
Finds the sum of the elements in the input 2D array. Sum2D obtains the sum using the following formula:

where i is the array row index, j is the array column index, numberOfRows is numberRows, and numberOfColumns is numberColumns.
The following example uses the Sum2D function.
double inputData[10][10];
double sum;
int i, j, numRows, numCols;
AnalysisLibErrType status;
numRows = 10;
numCols = 10;
/*/ Use a For loop to generate a 2D array of random numbers between 0.0 and 1.0 */
for (j = 0; j < 10; j++)
for (i = 0; i < 10; i++)
inputData[i][j] = Random(0.0, 1.0);
status = Sum2D(inputData, numRows, numCols, &sum);
Parameters
Input | ||
Name | Type | Description |
inputArray | void * | Input array whose elements are summed. This matrix must be an array of doubles. |
numberOfRows | ssize_t | Number of rows used in generating the sum of elements. |
numberOfColumns | ssize_t | Number of columns used in generating the sum of elements. |
Output | ||
Name | Type | Description |
sum | double | Sum of the elements of the input array. |
Return Value
Name | Type | Description |
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |
Additional Information
Library: Advanced Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later