14.10.2014 Views

gnuplot documentation

gnuplot documentation

gnuplot documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

62 <strong>gnuplot</strong> 4.3 57 LOAD<br />

hi !reread<br />

# execute last entry starting with "reread"<br />

hist !"set xr" # like above, several words enclosed in quotes<br />

hi !hi # guess yourself :-))<br />

On systems which support a popen function (Unix), the output of history can be piped through an<br />

external program by starting the file name with a ’|’, as one of the above examples demonstrates.<br />

56 If<br />

The if command allows commands to be executed conditionally.<br />

Syntax:<br />

if () [; else if () ...; else ...]<br />

will be evaluated. If it is true (non-zero), then the command(s) of the <br />

will be executed. If is false (zero), then the entire is ignored until the<br />

next occurrence of else. Note that use of ; to allow multiple commands on the same line will not end<br />

the conditionalized commands.<br />

Examples:<br />

pi=3<br />

if (pi!=acos(-1)) print "?Fixing pi!"; pi=acos(-1); print pi<br />

will display:<br />

?Fixing pi!<br />

3.14159265358979<br />

but<br />

if (1==2) print "Never see this"; print "Or this either"<br />

will not display anything.<br />

else:<br />

v=0<br />

v=v+1; if (v%2) print "2" ; else if (v%3) print "3"; else print "fred"<br />

(repeat the last line repeatedly!)<br />

See reread (p. 83) for an example of how if (p. 62) and reread (p. 83) can be used together to<br />

perform a loop.<br />

57 Load<br />

The load command executes each line of the specified input file as if it had been typed in interactively.<br />

Files created by the save command can later be loaded. Any text file containing valid commands can<br />

be created and then executed by the load command. Files being loaded may themselves contain load<br />

or call commands. See comments (p. 23) for information about comments in commands. To load<br />

with arguments, see call (p. 54).<br />

The load command must be the last command on a multi-command line.<br />

Syntax:<br />

load ""<br />

The name of the input file must be enclosed in quotes.<br />

The special filename "-" may be used to load commands from standard input. This allows a <strong>gnuplot</strong><br />

command file to accept some commands from standard input. Please see help for batch/interactive<br />

(p. 22) for more details.<br />

On some systems which support a popen function (Unix), the load file can be read from a pipe by<br />

starting the file name with a ’

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!