Re: simple query: including loop variable in filename? [message #55900] |
Fri, 14 September 2007 08:32 |
R.G.Stockwell
Messages: 163 Registered: October 2004
|
Senior Member |
|
|
<id6684@googlemail.com> wrote in message
news:1189766081.164014.99750@19g2000hsx.googlegroups.com...
>
> Hello Folks,
>
> I'm stranded with server downtime (thankfully with net access!) and
> looking to prepare a start on some IDL; can someone tell me please if
> it's possible to include from a FOR loop the variable we are looping
> over in the filename of some kind of file?
>
> eg;
>
> FOR i=0,1 DO BEGIN
> device, filename='i.jpg'
> plot_image, A
> ENDFOR
Others have answered, I just thought I'd add a tip to
include a format='(i3.3)'
command in your string commands, so that you print
out the numbers as 001 002 003. That makes alphabetical
listings go in order, and a bit more convenient to browse
through the files.
Cheers,
bob
|
|
|
|
|
|
Re: simple query: including loop variable in filename? [message #55909 is a reply to message #55906] |
Fri, 14 September 2007 04:13  |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Sep 14, 11:34 am, id6...@googlemail.com wrote:
> Hello Folks,
>
> I'm stranded with server downtime (thankfully with net access!) and
> looking to prepare a start on some IDL; can someone tell me please if
> it's possible to include from a FOR loop the variable we are looping
> over in the filename of some kind of file?
>
> eg;
>
> FOR i=0,1 DO BEGIN
> device, filename='i.jpg'
> plot_image, A
> ENDFOR
>
> so that I can produce filenames 0,1,2..etc.
>
> Thanks,
>
> David.
j=STRING(i)+'.jpg'
DEVICE, FILENAME=j
should do the trick
Chris
|
|
|