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

Home » Public Forums » archive » Re: Limiting concatenation IDL 5.5
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: Limiting concatenation IDL 5.5 [message #31228] Thu, 27 June 2002 22:11 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
"William Thompson" <thompson@orpheus.nascom.nasa.gov> wrote in message
news:afg4kr$hlu$1@skates.gsfc.nasa.gov...
> Randall Skelton <rhskelto@atm.ox.ac.uk> writes:
>
>> Ok... I have to ask. Is there actually a nice, clean way to
concatenate
>> multidimensional arrays in IDL?
>
>> a = make_array(2,2,2,2)
>> b = make_array(2,2,2,5)
>
>> data1 = [ [[[a]]] , [[[b]]] ]
>
>> Obviously the above fails, but what is the solution? Surely some
>> combination of rebin/reform...
>
> How about
>
> c = make_array(2,2,2,7)
> c(0,0,0,0) = a
> c(0,0,0,2) = b
>
> Of course, you'd want to put this into a routine, with calls to
SIZE(), etc.

[Uh, David, make sure Bill gets a seat on the board of that IDL Experts'
group.]

Nice point, Bill! Your idea takes a bit of hackery, I'll take a swipe at
some of it:

concatSize = Size(a)
concatSize[dim+1] = concatSize[dim+1] + (Size(b))[dim+1]
c=Make_Array(Size=concatSize)
nDims=Size(a,/N_Dimensions)
aDims=Size(a,/Dimensions)

; This needs to be generalized for all
; possible values of nDims from 1 to 8, (4 assumed)
; either by a CASE statement or tricky
; string handling and Execute():

c[0, 0, 0, 0] = a
c[dim eq 0 ? aDims[0] : 0, $
dim eq 1 ? aDims[1] : 0, $
dim eq 2 ? aDims[2] : 0, $
dim eq 3 ? aDims[3] : 0]=b

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Deleting from arrays
Next Topic: Matching Structure Tag Lengths

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

Current Time: Fri Oct 10 04:37:46 PDT 2025

Total time taken to generate the page: 0.64029 seconds