Admin Production ni-theme
Current Publication

Sort

LabWindows/CVI

Sort

AnalysisLibErrType Sort (double inputArray[], ssize_t numberOfElements, int direction, double outputArray[]);

Purpose

Sorts the input array in ascending or descending order.

Sort can perform the operation in place; that is, input and output arrays can be the same.

The following example uses the Sort function.

double inputData[10], sortedData[10];
AnalysisLibErrType status;

// Generate an array of random numbers
status = Uniform (10, 17, inputData);

status = Sort(inputData, 10, ANALYSIS_SORT_ASCENDING, sortedData);

Parameters

Input
Name Type Description
inputArray double [] Input array that contains the values to sort.
numberOfElements ssize_t Number of elements to sort.
direction int Specify a nonzero value or ANALYSIS_SORT_DESCENDING or select descending in the function panel to sort the elements in descending order.

Specify 0 or ANALYSIS_SORT_ASCENDING or select ascending in the function panel to sort the elements in ascending order. This is the default value.
Output
Name Type Description
outputArray double [] Sorted 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