Filling array in loop [message #77007] |
Mon, 18 July 2011 11:06 |
Alexa
Messages: 8 Registered: June 2011
|
Junior Member |
|
|
Hi All,
I'm trying to write a routine that loops through folders, grabs data
from each folder, and makes one large array out of all the
information. This is what I'm currently trying,
;;Open file with list of metallicities and put into an array
ReadCol, "MetalsList.txt", Metal, Format='a'
print, Metal
;;Create temporary arrays for the transitions
Result=FLTARR(41, 25)
;;Open the metals folders in order to read in col.txt
for nt=0, N_ELEMENTS(Metal)-1 do begin
cd, Metal[nt]
print, Metal[nt]
;;Read in column densities
ReadCol, 'Result.cd', U, result, Format='a'
cd, '..'
;Fill arrays
Result(nt)=[U, result]
print, Result
endfor
But instead of one large array, I get a smaller array for each folder.
Any suggestions on how I can fix this?
|
|
|