Re: Indexing problem.. Please help me out!!! [message #55704 is a reply to message #55701] |
Tue, 04 September 2007 20:06  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
DirtyHarry writes:
> First of all, I am really sorry to everyone here. I should have done
> this
> kind of stuff in other languages such as C++ or Fortran, but I
> couldn't.
I think this is your problem. You are used to this
being difficult, and with IDL it is so dead simple
you are confused. :-)
> What I am trying to do now is to merge 40 files with same format into
> one file. Fortunately, the format of those file is identical...
> actually each file is composed of 5 headers and one array
> (site_arr=3Dfltarr(25,365)). I don't need headers at all, and I just
> ignored them. I prepared for a big array(met_arr =3D fltarr(25,
> 365*40)) to accomodate the 40 files.
You need to make this a HECK of a lot simpler than
you are doing now. I would say something like this,
where "files" contains the files you want to open.
;*****************************************************
; Get the names of the files to read.
files = Dialog_Pickfile(/Multi, Filter='*.dat')
; Open a file for writing.
OpenW, fileout, 'bigfile.dat', /Get_Lun, WIDTH=12*25
; Read the data in a loop, and write it into the
; output file.
FOR j=0,N_Elements(files)-1 DO BEGIN
header = StrArr(5)
data = FltArr(25, 14600)
OpenR, filein, files[j], /Get_Lun
ReadF, filein, header, data
Free_Lun, filein
PrintF, fileout, data
ENDFOR
Free_Lun, fileout
;*****************************************************
That should pretty much do it. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|