当前位置首页 > 百科> 正文

MaxMin1D函式

2019-09-29 02:16:06 百科

MaxMin1D函式

MaxMin1D是NI Labwindows CVI开发环境中的一个系统函式,通过该函式可以获取一维数组的最大值、最小值以及最大值和最小值在数组中的序号。

基本介绍

  • 中文名:获取一维数组最大值和最小值
  • 外文名:MaxMin1D

概要

MaxMin1D函式返回输入数组中的最大值和最小值,以及最大值和最小值所在的位置,如果出现多个相等的最大值和最小值,MaxMin1D返回第一个值所在的位置,如果数组中所有元素值为NaNs(NotANumber,不是一个数),MaxMin1D返回最大值和最小值的索引(位置)为-1。
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.
参考事例如下:
double inputData[10];double maximumValue, minimumValue;int maximumIndex, minimumIndex;AnalysisLibErrType status; // Generate an array of random numbersstatus = Uniform (10, 17, inputData);status = MaxMin1D(inputData, 10, &maximumValue, &maximumIndex, &minimumValue, &minimumIndex);

参数

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.

返回值

Name
Type
Description
status
AnalysisLibErrType
A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

其它信息

使用MaxMin1D函式需添加如下头档案,系统会在编译的时候询问是否添加,所以该步骤可以省略!
Library: Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later
声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:baisebaisebaise@yeah.net