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

Home » Public Forums » archive » n Number of output files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
n Number of output files [message #92870] Tue, 15 March 2016 21:15 Go to next message
Sapna Mishra is currently offline  Sapna Mishra
Messages: 66
Registered: December 2015
Member
Hello all,

Can any one tell me how can I create n number of output files in idl.
For eg. I want to create fout(i).dat where i=0 to n. Instead of using openw,1 etc. is there any other way of creating it??
Re: n Number of output files [message #92874 is a reply to message #92870] Wed, 16 March 2016 10:31 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Wednesday, March 16, 2016 at 12:15:30 AM UTC-4, Sapna Mishra wrote:
> Hello all,
>
> Can any one tell me how can I create n number of output files in idl.
> For eg. I want to create fout(i).dat where i=0 to n. Instead of using openw,1 etc. is there any other way of creating it??

No you use OPENW. This question gets asked at least once per week. See what this does:
PRINT, STRING(FOUT[i],format='(A,".dat")')
Re: n Number of output files [message #92875 is a reply to message #92870] Wed, 16 March 2016 10:31 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 3/15/16 10:15 PM, Sapna Mishra wrote:
> Hello all,
>
> Can any one tell me how can I create n number of output files in
> idl. For eg. I want to create fout(i).dat where i=0 to n. Instead of
> using openw,1 etc. is there any other way of creating it??
>

Do you mean something like this? In general, I would always use the
/GET_LUN. Also, be careful, there are limits to the number of open files
at a given time.

luns = lonarr(n)
for i = 0L, n - 1L do begin
openw, lun, filename[i], /get_lun
luns[i] = lun
endfor

; do whatever you want here

for i = 0L, n - 1L do free_lun, luns[i]

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Coupled non linear first order equation
Next Topic: adding a 4th dimension to 3D array during concatenation

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

Current Time: Wed Oct 08 13:32:38 PDT 2025

Total time taken to generate the page: 0.00490 seconds