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

Home » Public Forums » archive » Modifying an array while conserving memory
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Modifying an array while conserving memory [message #30878] Thu, 23 May 2002 17:12 Go to previous message
Randall Skelton is currently offline  Randall Skelton
Messages: 169
Registered: October 2000
Senior Member
Hi all,

I have a large array and I would like to 'insert' some data into the
middle of it. Imagine an array of 1000 points and having 100 points to
insert beginning at index 500 (the resulting array will have 1100 points).
Typically, I do not know the length of data I wish to insert until after
'a' is defined.

a = findgen(1000)
b = randomu(seed,100)
c = fltarr(1100) ; seems wasteful to use more memory
c[0:499] = a[0:499]
c[500:599] = b
c[600:1099] = a[500:999]

In reality, 'a' is of order 2e7 so I would like to avoid making
multiple copies of it. Does anyone have any suggestions regarding the
most memory efficient way of doing this?

Many thanks,
Randall
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Modifying an array while conserving memory
Next Topic: url_get and idl -rt

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

Current Time: Wed Oct 08 15:37:47 PDT 2025

Total time taken to generate the page: 0.00380 seconds