Reputation: 958
I want to loop over the files basename0.00.txt
, basename0.01.txt
, ..., basename1.00.txt
.
Doing this doesn't work:
plot for [t = 0:1:0.01] 'basename'.t.'.txt'
Because t
is 0
, not 0.00
. I need to format it. How to go about this? I've tried using:
`sprintf("%3f", t)`
But I get:
sh: 1: Syntax error: word unexpected (expecting ")")
Are the backticks supposed to be there? Otherwise I get invalid command
.
gnuplot --version
# gnuplot 4.4 patchlevel 3
Upvotes: 1
Views: 416
Reputation: 48390
You can iterate only over integers:
plot for [i=0:100] sprintf('basename%.2f.txt', i/100.0)
That works fine with 4.4.4
Upvotes: 1