Minspa (dest, swath, source) – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 189

Advertising
background image

Section 8. Processing and Math Instructions

8-17

MaxSpa Function Example

This example uses MaxSpa to find the maximum value of the five elements
Temp(6) through Temp(10) and store the result in the variable MaxTemp.

MaxSpa(MaxTemp, 5, Temp(6))

MinSpa (Dest, Swath, Source)

Finds the minimum value in an array.

Syntax
MinSpa(
Dest, Swath, Source)

Remarks
Find the minimum value in the given array and place the result in the variable
named in Dest. The Source must be a particular element in an array (e.g.,
Temp(1)); it is the first element in the array to check for the minimum. The
Swath is the number of elements to compare for the minimum.

Parameter
& Data Type

Enter

Dest
Variable

The variable in which to store the results of the instruction.

Swath
Constant

The number of values of the source array in which to search of the
minimum.

Source
Array

The name of the variable array that is the input for the instruction.

MinSpa Function Example

This example uses MinSpa to find the minimum value of the five elements
Temp(6) through Temp(10) and store the result in the variable MinTemp.

MinSpa(MinTemp, 5, Temp(6))

Mod

Divides two numbers and returns only the remainder.

Syntax
result = operand1 Mod operand2

Remarks
The modulus, or remainder, operator divides operand1 by operand2 (rounding
floating-point numbers to integers) and returns only the remainder as result.
For example, in the expression A = 19 Mod 6.7, A (which is result) equals 5.
The operands can be any numeric expression.

Mod Operator Example

The example uses the Mod operator to determine if a 4-digit year is a leap
year.

Advertising