Calculations on the values of columns which numbers are given by variables in Gnuplot

StackOverflow https://stackoverflow.com/questions/23180761

  •  06-07-2023
  •  | 
  •  

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?

Was it helpful?

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top