MathGL – library for scientific graphics


Main

News

Features

MGL script

Pictures

FAQ

Download

Documentation

Contact

Other projects

SourceForge.net Logo thefreecountry.com: Free Programmers' Resources, Free Webmasters' Resources, Free Security Resources, Free Software

MathGL library supports (from version 1.3) the simplest scripts for data handling and plotting. These scripts can be used independently (with the help of mgl2png, mgl2eps, mgl2svg programs and others) or in the frame of the library using. 

MGL script language is rather simple. Each string is a command. First word of string is the name of command. Other words are command arguments. Command may have up to 500 arguments (at least for now). Words are separated from each other by space or tabulation symbol. The upper or lower case of words is suficient, i.e. variables a and A are different variables. Symbol # starts the comment (all characters after # will be ignored). The exception is situation when # is a part of some string. Also options can be specified at the end of string (after symbol ';').

If string contain references to external parameters (substrings "$0", "$1" ... "$9") then before execution the values of parameter will be substituted instaed of reference. It allows to use the same MGL script for different parameters (filenames, paths, condition and so on).

Argument can be a variable name, a string or a number. Variable name is arbitrary combination of symbols (except spaces and ') started from a letter and with length less than 64. It is possible to use subarrays (like in subdata command) as command argument. For example, a(1) or a(1,:) or a(1,:,:) is second row, a(:,2) or a(:,2,:) is third column, a(:,:,0) is first slice and so on. The string is any symbols between ordinary marks ('). Special variables nan=#QNAN, pi=3.1415926..., on=1, off=0, :=-1 are treated as number if they were not redefined by user. Before the first using all variables must bedefined with the help of commands new, var, list, copy or read.

Detailed description of the MGL language here. More examples and hints can be found here.