Am 23.02.2017 um 14:32 schrieb Schaff, Frederik:
Many thanks,
I tried a slightly different version from yours: -------- .... (see
first comment) scalar j = 0 loop foreach i xs j++ print j $i <-
gnuplot $i ys[j] endloop -------- unfortunately it is not working.
Also, what if I wanted to combine the var names of both the items?
Your option would not allow this. Is there now way to simply access
the name of a var by means of the name of the var?
Actually I was too cautios, the yy[i] trick does work in the foreach
loop. Here's a tested example:
<hansl>
open denmark
list xx = IBO IDE
list yy = LRM LRY
loop foreach i xx
plot_$i <- gnuplot $i yy[i]
endloop
</hansl>
Notice three things:
1) Just $i on the left-hand side as the symbol name doesn't seem to be
allowed, probably because it's already an identifier in use. Don't know
whether it's a bug or not, but as a workaround I added the prefix plot_.
2) When you want to insert the name of the variable, we use $i.
3) The variable i itself is an integer counter, so we use it in yy[i].
hth,
sven