Re: concatenating beyond [[[]]] [message #32656 is a reply to message #32653] |
Wed, 23 October 2002 14:33  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
mperrin+news@arkham.berkeley.edu (Marshall Perrin) writes:
> How best to venture into the land where square brackets fail?
> I want to concatenate some 3D data cubes into a 4D dataset.
> (Basically this is a cube of images produced as I vary two
> parameters in a simulation). Square brackets don't work.
> Is there any more elegant or faster solution than just a
> for loop wrapped around
> bigarr[*,*,i,j] = littlearr[*,*]
> ?
>
> In particular it would be nice to be able to append an entire
> 3D 'slice' to my 4D data cube without having to re-allocate
> a new larger array and copy everything over, but that's probably
> not easy to do, is it?
Yes, it would be nicer and more elegant, but it won't be faster. If
in your FOR loop you fill 2D slices all at once, then the overhead of
a FOR loop will be negligible.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|