|
From: Ethan A M. <merritt@u.washington.edu> - 2008-07-19 04:14:49
|
On Friday 18 July 2008, Lutz Maibaum wrote:
> On Friday 18 July 2008 15:46:27 Ethan Merritt wrote:
> > On Friday 18 July 2008 15:23:34 Lutz Maibaum wrote:
> > > I have no answer to your question, but your email reminded me of a
> > > feature that I think would be very nice to have, the support of
> > > wildcards in filenames.
>
> > > plot "file[1-3]" <all your options>
>
> > We already have that:
> >
> > plot for [i=1:3] "file".i <all your options>
>
> Thanks, Ethan, I didn't know about plot iterations. It seems like they are
> limited to integers, are there any plans to allow iterations over string
> lists? It would be great if one could do something like
>
> plot for (filename in test*.dat) i <all your options>
>
> or at least
>
> plot for (filename in `ls test*.dat`) i <all your options>
>
> Right now it seems like I would have to do something like
>
> list="`ls test*.dat`"
> plot for [i=1:words(list)] word(list,i)
>
> which actually does not work
It works. You just have to use a slight variant:
list = system("ls test*.dat")
plot for [i=1:words(list)] word(list,i) title word(list,i)
I have toyed with the idea of having an explicit string iterator that
would do this automatically, something like
list = system("ls *.dat")
plot for [FILE in list] FILE
but it turns out to require more code than I would have guessed, and
it didn't seem worth it since the capability is there already.
But if someone has a clever idea for implementation perhaps there is
an easier way than I found at the time.
--
Ethan A Merritt
|