ocmath_us_minmax
Description
Find indices to min/max values and also to return the number of missing values in the given range.
Syntax
uint ocmath_us_minmax( const USHORT * pData, uint i1, uint i2, const USHORT * pMissing, uint * pnmin = NULL, uint * pnmax = NULL )
Parameters
- pData
- [input] pointer to vector data,
- i1
- [input] starting index to search for min max
- i2
- [input] ending index (inclusive) to search min max
- pMissing
- [input] Think as missing value, can be NULL if no missing values are defined
- pnmin
- [output] index to the found min value location
- pnmax
- [output] index to the found max value location
Return
number of missing values. If all values in range are missing values, then return (i2-i1+1). If none are missing values then returns 0
Examples
EX1
void ocmath_us_minmax_Ex1()
{
vector<float> v = {1,2,3,4,5,2,3,4,54,3,3,4,3,3};
v[7] = -1.23e-123;
uint i1 = 2, i2 = v.GetSize() - 1;
float dNam =-1.23e-123;
uint nMin,nMax;
uint nMissingValues = ocmath_f_minmax(v, i1, i2, &dNam, &nMin, &nMax);
printf("%d %d %d\n",nMissingValues,nMin,nMax);
//nMissingValues=1 nMin=5 nMax=8
}
Remark
Find indices to min/max values and also to return the number of missing values in the given range
Data types supported:
- double: ocmath_d_minmax
- float: ocmath_f_minmax
- int: ocmath_i_minmax
- unsigned short: ocmath_us_minmax
- unsigned char: ocmath_b_minmax
- complex: ocmath_z_minmax
See Also
ocmath_d_minmax, ocmath_i_minmax, ocmath_b_minmax, ocmath_z_minmax
header to Include
origin.h
Reference
|