user3878381
user3878381

Reputation: 9

Gnuplot:Same Loop for input and output file

I would like to do the following thing

set output 'error0.tex'
plot 'error0.dat' using 1:2 title 'Error x', \
error0.dat' using 1:3 title 'Error y'
...
...
set output 'error10.tex'
plot 'error10.dat' using 1:2 title 'Error x', \
error10.dat' using 1:3 title 'Error y'

Is there any simple way to get this?

So i get 10 different files with 2 graphs in it.

Upvotes: 0

Views: 138

Answers (1)

andyras
andyras

Reputation: 15910

Oh my, yes:

do for [ii=0:10] {
  set output 'error'.ii.'.tex'
  plot 'error'.ii.'.dat' u 1:2 t 'Error x', \
    '' u 1:3 t 'Error y'
}

(assuming gnuplot >=4.6)

Type help do, help for or help iteration at the gnuplot prompt for more.

Upvotes: 1

Related Questions