Donnerstag, 28. November 2013

gnuplot array

How does it work to have an array in gnuplot?

The simplest way to create an array is like this:
 array="1 2 3 4 5"

to address a element you simple use the word command (for the zeroth element e.g.):
 word(array, 0)

In a real exercise you could use it e.g. to loop over files:
files="file1 file2 file3"
plot for [i=0:2] word(files,i) u 1:2 ti word(files,i)

Keine Kommentare:

Kommentar veröffentlichen