n Number of output files [message #92870] |
Tue, 15 March 2016 21:15  |
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 #92875 is a reply to message #92870] |
Wed, 16 March 2016 10:31  |
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)
|
|
|