Functions and operators

The following functions and operators can be used in rules. This means that they are recognized by the rule parser and will be handled by the system. Not all functions are relevant in all situations.

Functions

The following functions can be used in the rule system.

Standard functions

abs, sin, cos, tan, sinh, cosh, tanh, ln, log, log10, log2, exp, sqrt

Unlimited number of arguments

min, max, sum

String functions

  • str2dbl – Converts a string to float value.

  • strlen – Returns the string length.

  • tolower – Converts lowercase letter to uppercase.

  • toupper – Converts uppercase letter to lowercase.

Complex functions

  • real – Returns a value as real a number.

  • imag – Returns imaginary part of the complex number.

  • conj – Returns the conjugate of the complex number.

  • arg – Returns the argument of the complex number.

  • norm – Returns the norm value of a complex number.

Array functions

  • sizeof – Returns the size of the expression.

  • eye – Creates a matrix with ones in the main diagonal and zeros everywhere else.

  • ones – Creates a new m x n matrix filled with ones.

  • zeros – Creates a new m x n matrix filled with zeros.

Special functions

  • rgb – For generating a color

    int rgb(int r,int g,int b)

  • minval – For determining the minimum value of a logistical field for the active block

    float minval(char field)

  • maxval – For determining the maximum value of a logistical field for the active block

    float maxval(char field)

  • strcmp – For comparing two strings, case sensitive *

    strcmp(const char *str1, const char *str2)

  • stricmp – For comparing two strings, case insensitive *

    strcmp(const char *str1, const char *str2)

  • strval – For converting character value to numerical value

    float strval(char field,char value)

  • rainbow – Returns a rainbow of colors corresponding to value clamped by min (red) and max (blue), using the defined number of colors.

    int rainbow(float min,float max,float value,number of colors)

  • inv_rainbow – Returns an inverse rainbow of colors corresponding to value clamped by min (blue) and max (red), using the defined number of colors.

    int inv_rainbow(float min,float max,float value,number of colors)

  • frame_d – Returns the decimal frame number corresponding to the specified length.

    float frame_d(float length)

  • string frame_o(float length) – Returns the frame number and offset corresponding to the specified length.

    string frame_o(float length)

  • wldcmp – For comparing strings using wildcards. Returns a boolean value true if the arguments match, and false if they do not match. The first argument is the variable to search in, and the second argument is the search string in double quotes. Wildcards * and ? can be used in the search string before and after actual characters. Examples:

    • wldcmp(Processingname,"*-S*") $ "1"

    • wldcmp(Processingname,"?-S*") $ "1"

    • wldcmp(Processingname,"?-S?") $ "1"

Operators

The following operators can be used in the rule system.

  • Standard operators: +, -, *, ^
  • Logical operators: and, or, xor, ==, !=, >, <, >=
  • String concatenation: //