You must use column(i)
: $1
is a shortcut for column(1)
.
plot for [i=2:n-1] fn u 1:(column(i)-$1) w lp
Question
I'm using loop for plotting, number of the column is determined by the variable. When I want to calculate the difference between two columns values this doesn't work. What I want to do looks approximately in this way:
plot for [i=2:n-1] fn u 1:($i-$1) w lp
Is it not possible in principle to use the variable column number for calculation?
Solution
You must use column(i)
: $1
is a shortcut for column(1)
.
plot for [i=2:n-1] fn u 1:(column(i)-$1) w lp