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?
Best
Frederik
-----Ursprüngliche Nachricht-----
Von: gretl-users-bounces(a)lists.wfu.edu [mailto:gretl-users-
bounces(a)lists.wfu.edu] Im Auftrag von Sven Schreiber
Gesendet: Donnerstag, 23. Februar 2017 14:11
An: gretl-users(a)lists.wfu.edu
Betreff: Re: [Gretl-users] loop, string substitution and varname from list
Am 23.02.2017 um 08:30 schrieb Schaff, Frederik:
> I am constructing a set of xy plots in a loop, using a predefined list
> of variables for the plots. I'd like the names of the plots to include
> the variables names. Here is a MWE, including some comments on what I
> tried and did not work:
> Any idea how I can make this work?
Maybe something like this (untested):
loop foreach i xs
$i <- gnuplot $i ys[i]
endloop
Not sure the ys[i] would work inside this loop, though. Perhaps you would
have to use another index j, initialize that to 1 and increment manually via j++
at the end.
But definitely look up the doc for the foreach-variant of the loop.
cheers,
sven
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users