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

Home » Public Forums » archive » Array Concatenation 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 [message #48958 is a reply to message #42493] Wed, 07 June 2006 08:06 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
maye wrote:
> Hi folks,
> I was searching for an effective way to do this, but can't find anybody
> writing about what (as usual) seems to be an obvious problem/task to
> me. :)
> I don't know how many elements I will collect while scanning a bunch of
> images, so I want to use array concatenation to collect the values like
> this:
> means = [means, currMean]
> But for this to compile/run properly, I need mean to exist before.
> If I do a
> means = 0.
> before the loop, I will always have a zero-element in the beginning
> that I don't want at plotting time. Of course I could remove it with
> means = means[1:*]
> but not only does this waste resources, it also becomes cumbersome if I
> collect 20 different data values, for that I ALL have to remove the
> first value?
> Surely there must be a better way?
> Please help me to program IDL efficiently! :)
> Best regards,
> Michael
>

I have a class MGArrayList that I use for such things. It follows the
same interface as IDL_Container, but allows for any IDL data type (one
data type per object). So for example,

IDL> olist = obj_new('mgarraylist', example=0.0, blocksize=10)
IDL> olist->add, 3.0
IDL> olist->add, 5.0
IDL> olist->add, 10.0
IDL> print, olist->get(/all)
3.00000 5.00000 10.0000

There's more info along with links to download and API documentation at:

http://michaelgalloy.com/?p=11

Mike
--
www.michaelgalloy.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: End Statement Syntax Problem
Next Topic: Re: IDL and the RAM memory

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

Current Time: Fri Oct 10 19:38:37 PDT 2025

Total time taken to generate the page: 0.40320 seconds