comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Incremental variable names?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Incremental variable names? [message #37914 is a reply to message #37913] Sun, 01 February 2004 20:55 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jonathan Greenberg writes:

> Have a question about variable names. Is there any way to create and then
> call variable names that have some incremental value in them, e.g.:
>
> t0
> t1
> t2
>
> Etc... I want to be able to first create and assign a value to tn where n =
> 0 to whatever, and then be able to subsequently call that variable using a
> loop.

Here is how I do this in one of my programs. In this
case, the files are named image01.tif, image02.tif...
image53.tif.

FOR j=0, 53 DO BEGIN
filename = 'image' + String(j, Format='(I2.2)') + '.tif'
Write_Tiff, filename, Reverse(Reform(head[*,*,j]),2)
ENDFOR

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: object graphics question
Next Topic: Re: Virtual Machine Crashes :-(

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 00:37:48 PDT 2025

Total time taken to generate the page: 0.16272 seconds