MaxMin1D
AnalysisLibErrType MaxMin1D (double inputArray[], ssize_t numberOfElements, double *maximumValue, ssize_t *maximumIndex, double *minimumValue, ssize_t *minimumIndex);
Purpose
Finds the maximum and minimum values in the input array and their locations in the array. If there are multiple instances of the maximum and/or minimum values, MaxMin1D returns the location of the first occurrence. If all the elements in the input array are NaNs, MaxMin1D returns -1 for both the index of the maximum value and the index of the minimum value.
The following example uses the MaxMin1D function.
double inputData[10];
double maximumValue, minimumValue;
int maximumIndex, minimumIndex;
AnalysisLibErrType status;
// Generate an array of random numbers
status = Uniform (10, 17, inputData);
status = MaxMin1D(inputData, 10, &maximumValue, &maximumIndex, &minimumValue, &minimumIndex);
Parameters
Input | ||
Name | Type | Description |
inputArray | double [] | The array from which the maximum and minimum values and their locations within the array are determined. |
numberOfElements | ssize_t | Number of elements used in determining the maximum and minimum values. |
Output | ||
Name | Type | Description |
maximumValue | double | Maximum value found in the input array. |
maximumIndex | ssize_t | The index of the maximum value found in the input array. |
minimumValue | double | Minimum value found in the input array. |
minimumIndex | ssize_t | The index of the minimum value found in 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: Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later