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

Home » Public Forums » archive » Re: Concatenate arrays of different dimensions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Concatenate arrays of different dimensions [message #51168] Wed, 08 November 2006 09:52
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Gianguido Cianci wrote:
> I seem to remember that concatenation is slow with big arrays or
> something...
[...]
> a[*]=-1

If speed is a concern, REPLICATE or REPLICATE_INPLACE should be faster!

Jean
Re: Concatenate arrays of different dimensions [message #51171 is a reply to message #51168] Wed, 08 November 2006 09:31 Go to previous message
cgguido is currently offline  cgguido
Messages: 195
Registered: August 2005
Senior Member
I seem to remember that concatenation is slow with big arrays or
something...

If you have to do this often (especially inside a loop!) and if you can
put a higher limit on the number of rows, I would do:

a=fltarr(40,N) ; you would do this outside the loop, if any.
; where N is a number that is an over estimate of the size you will
need at the end.

a[*]=-1
; or some value you know won't appear in real data. I seem to only ever
encounter positive ; numbers :-) Dunno if you could fill it with
NaNs....

;now you fill a with your sub arrays
a[*,0:29]=f
a[*,30:300+29]=f1
a[*,330:3330+329]=f2

;finaly clean it up
b=a[where(a[*] ne -1)]
a=0

Or someting along these lines anyway... hope this helps.

Gianguido
Re: Concatenate arrays of different dimensions [message #51178 is a reply to message #51171] Wed, 08 November 2006 06:51 Go to previous message
Dilkushi@gmail.com is currently offline  Dilkushi@gmail.com
Messages: 21
Registered: August 2006
Junior Member
Thank you Greg for your prompt reply
:)
blessings
dilkushi

greg michael wrote:
> Try: ff=[[f],[f1],[f2]]
>
> regards,
> greg
Re: Concatenate arrays of different dimensions [message #51182 is a reply to message #51178] Wed, 08 November 2006 06:46 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
Try: ff=[[f],[f1],[f2]]

regards,
greg
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: array juggling
Next Topic: Array juggling help needed

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

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

Total time taken to generate the page: 0.00618 seconds