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

Home » Public Forums » archive » Re: creating multiple files
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: creating multiple files [message #47364 is a reply to message #47363] Mon, 06 February 2006 20:55 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
bressert@gmail.com writes:

> I am currently writing a script in IDL where I'm trying to create
> multiple files. What is essentially being done is the following:
>
> 1) grabbing a large 4 by 400,000 matrix and then spliting it up by a
> specific criteria
>
> 2) splitting up the file will create about 12,000 different files
>
> 3) how do I routine a process where I can name a variable, i.e. sun'j'
> = ....
> where 'j' is an iterating number from 0 to 11,999.
>
> 4) afterwards, the script involves an openw and printf with file names
> of "sun'j'.dat".
>
> The last property that should be mentioned is that 'j' is a result of
> array processing. No loops are involved in the script.
>
> Thank you for regarding the inquiry and any advice would be greatly
> appreciated.

If "j" is any number between 0 and 11,999, and you want file
names like:

sun5.dat
sun195.dat
sun11493.dat

Then you simply create your filename like this:

filename = 'sun' + StrTrim(j,2) + '.dat'

If you want filenames like this:

sun00005.dat
sun00195.dat
sun11493.dat

Then you create your filename like this:

filename = 'sun' + String(j, Format='(I5.5)') + '.dat'

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: creating multiple files
Next Topic: Re: cannt disable widget timer event?

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

Current Time: Thu Oct 09 21:41:04 PDT 2025

Total time taken to generate the page: 0.96110 seconds