MakerPlot-J supports a wide assortment of math operations for use in update values, plotting formulas and code. MPJ support standard math operations with precedence defined by the operation and parenthesis and post-fix math used for faster operation, string operations and other specialized operations.
Standard Math is performed by enclosing the operation in braces, { }, such as testing with the DEBUG/CLI:
? { 2 + 3 } ? { 2 * (3 + 4) } ? { 2 * [ain0]} // Use analog value 0 ? { 2 * sin(rad(45)) } // convert 45 degrees to radians and get sine. ? !txtAverage = { ([txtNum1] + [txtNum2]) / 2 }
See Standard Math for more information and operators.
Post-Fix Math operations process from left to right and are indicated using {:: }. Data is stored in a math stack and pulled off as necessary to perform operation given and the result is placed onto the top of the stack. This operations process much faster than standard math operations in general. String operations containing spaced require :: to separate parameters and operations.
? {:: 2 3 + }
? {:: 2 3 4 + * }
? {:: Hello World::World::There::replace} // Replace World with there
See Post-Fix Math for more information and operations.
|