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

Home » Public Forums » archive » Re: array concatenation and optimization
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: array concatenation and optimization [message #26790 is a reply to message #26789] Wed, 26 September 2001 14:29 Go to previous messageGo to previous message
Brian Jackel is currently offline  Brian Jackel
Messages: 34
Registered: January 1998
Member
Hi

This is what I generally do

dat= {struct, a:fltarr(3), b:intarr(4), c:0b} ;example structure
OPENR,lun,filename,/GET_LUN
READU,lun,dat ;read one record
fs= FSTAT(lun) ;look at current file information
nrec= fs.size/fs.cur_ptr
IF (fs.size GT 100000000L) THEN BEGIN ;avoid out-of-memory errors
FREE_LUN,lun
MESSAGE,'Error- file larger than 100Mbytes, returning'
ENDIF
POINT_LUN,lun,0
data= REPLICATE(dat,nrec)
READU,lun,data ;read all the data at once
FREE_LUN,lun

I'm not sure how well this will work with compressed files.

Brian


Sean Raffuse wrote:
>
> Hello.
>
> I am trying to read a bunch of data from a file to a structure array. I'm
> not sure many data entries the file will have until I have read it and so I
> am increasing the size of the structure array after reading each line. I do
> this by concatenating.
>
> adp_struct_single is the structure as a "scalar"
> adp_struct is the array
>
> I concatenate like so:
> adp_struct =[adp_struct, adp_struct_single]
>
> This is working but it has increased the processing time of my loop by an
> order of magnitude. Is there a better way to do this? Is there a reason
> this is so slow?
>
> Thanks in advance.
>
> -Sean Raffuse
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL 5.4 and win2000 problems
Next Topic: IDL for Windows and MAC...

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

Current Time: Sat Oct 11 13:09:19 PDT 2025

Total time taken to generate the page: 1.19863 seconds