Sub2D
- Updated2023-02-21
- 1 minute(s) read
AnalysisLibErrType Sub2D (void *arrayX, void *arrayY, ssize_t numberOfRows, ssize_t numberOfColumns, void *outputArray);
Purpose
Subtracts two 2D arrays, element by element. Sub2D obtains the (i, j)th element of the output array using the formula:
zi, j = xi, j – yi, j
Sub2D can perform the operation in place; that is, the input and output arrays can be the same.
The following example uses the Sub2D function.
double arrayX[10][10], arrayY[10][10], outputArray[10][10];
int i, j, numRows, numCols;
AnalysisLibErrType status;
numRows = 10;
numCols = 10;
/* Use a For loop to generate two 2D arrays of random numbers between 0.0 and 1.0 */
for (j = 0; j < 10; j++)
for (i = 0; i < 10; i++)
{
arrayX[i][j] = Random(0.0, 1.0);
arrayY[i][j] = Random(0.0, 1.0);
}
status = Sub2D(arrayX, arrayY, numRows, numCols, outputArray);
Parameters
Input | ||
Name | Type | Description |
arrayX | void * | First array used in the array subtraction operation. This array must be an array of doubles. |
arrayY | void * | Second array used in the array subtraction operation. This array must be an array of doubles. |
numberOfRows | ssize_t | Number of rows used in the array subtraction operation. |
numberOfColumns | ssize_t | Number of columns used in the array subtraction operation. |
Output | ||
Name | Type | Description |
outputArray | void * | Result array, which is an array of doubles. |
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: Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later