Credits Overview Plotting Styles Commands Terminals

ARGV[ ]

When a gnuplot script is entered via the call command any parameters passed by the caller are available via two mechanisms. Each parameter is stored as a string in variables ARG1, ARG2, ... ARG9. Each parameter is also stored as one element of the array ARGV[9]. Numerical values are stored as complex variables. All other values are stored as strings. ARGC holds the number of parameters. Thus after a call

     call 'routine_1.gp'  1 pi "title"

The three arguments are available inside routine_1.gp as follows

     ARGC = 3
     ARG1 = "1"         ARGV[1] = 1.0
     ARG2 = "3.14159"   ARGV[2] = 3.14159265358979...
     ARG3 = "title"     ARGV[3] = "title"

In this example ARGV[1] and ARGV[2] have the full precision of a floating point variable. ARG2 lost precision in being stored as a string using format "%g".

ARGC and a corresponding array ARGV[ARGC] are also available to code inside a function block call. However invocation of a function block does not create string variables ARG1,... .