| Credits | Overview | Plotting Styles | Commands | Terminals |
|---|
Starting with gnuplot version 6, an array can be passed to a function or returned by a function. For example a simple dot-product function acting on two equal-sized numerical arrays could be defined:
dot(A,B) = (|A| != |B|) ? NaN : sum [i=1:|A|] A[i] * B[i]
Built-in functions that return an array include the slice operation array[min:max] and the index retrieval function index(Array,value).
T = split("A B C D E F")
U = T[3:4]
print T
[ "A", "B", "C", "D", "E", "F" ]
print U
[ "C", "D" ]
print index( T, "D" )
4
Note that T and U in this example are now arrays, whether or not they had been previously declared.