Functions > Miscellaneous Functions
The following functions are described in this Section:
|01. constants||02. echo||03. format||04. getstring|
|05. getusernum||06. getuserstr||07. messagebox||08. plot|
|09. pop||10. push||11. savefile||12. ticks|
|13. unit||14. vars|
Displays names of all the constants defined by Math Processor. You cannot change or remove the value of a constant.
Expects one or more arguments. All the arguments are converted to a text representation and then the Math Processor engine sends the resulting text to the GUI module. It is up to the GUI module to decide how to deal with the output request. A compiling GUI will, in general, output the text on the screen
By default, Math Processor shows the numerical output in fixed precision format using 4 decimal digits. The format directive can be used to get or set the output format. It has two forms:
- If no argument is passed, shows the current number format.
- If format is passed as argument, it will be used to format numbers for subsequent output. Following values can be passed as format. For each format, digit is a digit between 0 and 99.
- E or e followed by digit: Scientific notation.
- F or f followed by digit: Fixed point precision.
- G or g followed by digit: General number format.
- N or n followed by digit: Number. Uses group seprators.
- P or p followed by digit: Percentage.
- R or r followed by digit: Round trip.
Returns a variable of type "Text" containing text representation of the passed argument. The passed argument can be of type text, vector (number or array), matrix or bool. In case of numerical argument, an extra argument can be passed as the number format. To see what number formats are allowed, please refer to the format function.
Displays an input box to get numeric input from the user. It has the following form
Displays an input box to get text input from the user. It has the following form
Displays a message box. Its format is:
Note: Do not forget to enclose text inside quotations marks if it contains spaces.
This has now moved to the Plotting page.
Pop a value off the MP stack previously stored there using the push method (described next).
MP provides a stack based storage mechanism. It is usually used to store temporary values which you do not need to store using a variable. For example, you may want to temporarily change the output format using the format() method. For such a purpose you can use a combination of push() and pop(), like this:
push(format(G)) : /*change display format to 'G' */
format(pop()) ;: /*Change format back to whatever it was when we pushed.*/
Allows to export data to a file e.g. XML, .html or simple text files. It has the following two forms:
- savefile(data, path)
If the first form is used, the function will open a Save File Dialogue to allow the user to choose a location and file. If the second form is used, the file path/name are provided as the second parameter. The path can be relative (e.g. file.txt or absolute e.g. C:\file.txt).
Gives the number of milliseconds since the system started.
By default, Math Processor uses Radian as standard unit for calculations e.g. in functions like sin, cos etc. The unit function can be used to get or set the unit of calculations. This function has the following form:
The bracket around argument shows that it is optional. The pipe (|) signifies that one of the four provided values is to be used. deg/degrees will set the unit to degrees and rad/radians will set it to radians.