Using Array Parameters within Conditional Expressions

While individual array elements can always be used as single quantities within calculations, you can also use entire array parameters with statistical functions.

When you use array parameters in calculations, you must consider the following:

  • Array functions do not support array slices. You must use either a single element of the array or the entire array.

  • Elements of multi-dimensional arrays can be referenced as array[i][j] or as array[i, j].

  • An array can be used as an argument to any operator or function. The operator or function is applied to each element of the array and an array of the same size is returned. If multiple arrays are used as arguments, they must all be the same size and shape. For example, to normalize all elements of an array, enter the following:

    dy = dy - mean(dy)

In the following figure an array parameter called dy is used in a calculation:



  • You can pass only one array parameter to a statistical function, such as sum(dy). You can pass multiple scalar variables, such as sum(s1,s2,s3,).

  • Only arrays of numeric data type (real, integer) are available for use in calculations.

  • The following statistical functions have special behavior when they pass one array as an argument. Instead of acting separately on each element of the array, the functions build a single result from the values of all array elements. These functions can take a 1D vector or a 2D matrix (or higher dimensional array). All array elements are processed as if the whole array was flattened to a single vector.

    sum

    Sum of all elements of the array.

    min

    Minimum value of all elements in the array.

    max

    Maximum value of all elements in the array.

    mean

    Mean value of all elements in the array.

    stddev

    Standard deviation of all array elements from the mean.

    absSum

    Sum of the absolute values of all elements in the array.

    absMax

    Maximum of the absolute values of all elements in the array.

    absMin

    Minimum of the absolute values of all elements in the array.

  • The following functions also take an array as an argument and return information about that array:

    maxIdx

    Index of the maximum value in a 1D array.

    minIdx

    Index of the minimum absolute value in a 1D array.

    absmaxIdx

    Index of the maximum absolute value in a 1D array.

    absminIdx

    Index of the minimum absolute value in a 1D array.

    size

    Returns the total number of elements in the array. Works for single and multi-dimensional arrays.

    dim (array, dimension)

    Returns the size of a single dimension of a multi-dimensional array. Dimensions are counted starting at 1, so dim (table, 1) is the number of rows, and dim (table, 2) is the number of columns.