Advanced Analysis Library Only
AnalysisLibErrType Mode (double inputArray[], int numberOfElements, double base, double top, int intervals, double *mode);
![]() |
Note This function is obsolete. National Instruments recommends that you use ModeEx instead. |
Finds the mode of the input array. The mode is defined as the value that most often occurs in the array. Mode determines the mode in terms of the histogram of the input array.
/* Generate a Gaussian distributed random array and find its mode. */
double x[2000], max, min, modeval;
int n, intervals, imax, imin;
n = 2000;
intervals = 50;
GaussNoise (n, 1.0E0, 17, x);
MaxMin1D (x, n, &max, &imax, &min, &imin);
Mode (x, n, min, max, intervals, &modeval);
Input | ||
Name | Type | Description |
inputArray | double-precision array | Input array used to determine the mode. |
numberOfElements | integer | Number of elements used to determine the mode. |
base | double-precision | Lower range over which the mode value is determined. The mode value is in the range [base:top]. Default Value: 0.0. |
top | double-precision | Upper range over which the mode value is to be determined. The mode value is in the range [base:top]. Default Value: 0.0. |
intervals | integer | The resolution of the discrete intervals used to determine the mode. Default Value: 1. |
Output | ||
Name | Type | Description |
mode | double-precision | Mode value of the input array. Because this process is discrete, the value of mode is the midpoint value of the interval that occurs most often. |
Name | Type | Description |
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |