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

Home » Public Forums » archive » Re: Filling array in loop
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: Filling array in loop [message #77004] Mon, 18 July 2011 11:53 Go to previous message
Alexa is currently offline  Alexa
Messages: 8
Registered: June 2011
Junior Member
On Jul 18, 2:46 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Jul 18, 3:06 pm, Alexa <alexa7...@gmail.com> wrote:
>
>
>
>> 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?
>
> On each pass through the line
>
> ReadCol, 'Result.cd', U, result, Format='a'
>
> I would expect (I do not know the details of readcol) the array result
> to be reassigned, containing just what was read, throwing out whatever
> was in it before. If so, you can just use another variable for
> readcol.

Thanks! I just remembered that IDL doesn't care about capitalization.
[Message index]
 
Read Message
Read Message
Previous Topic: Filling array in loop
Next Topic: Transferring image pixel values to a DICOM file

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

Current Time: Fri Oct 10 13:14:00 PDT 2025

Total time taken to generate the page: 0.40268 seconds