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

Home » Public Forums » archive » adding a 4th dimension to 3D array during concatenation
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: adding a 4th dimension to 3D array during concatenation [message #92878 is a reply to message #92869] Wed, 16 March 2016 20:46 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Tuesday, March 15, 2016 at 6:37:18 PM UTC-4, Wayana Dolan wrote:
You can go ahead with the list suggestions but if you do know how many arrays you want to concatenate, then it is even more efficient to build your array beforehand.

outarr = fltarr(91,41,33,16)
for i=0,15 do begin
.... Make an array x with dimensions (91,41,33)
outarr[0,0,0,i] = x
endfor

x = transpose(x, [3,0,1,2])

Now for efficiency reasons it is better to make the last dimension 16 rather than the first. But if you really want the first dimension to be the "counting" dimension then you can use TRANSPOSE() as above to rearrange things.


> So outside a loop I start out with an empty array (ex. array=[ ] ). Then each time through the loop, I make an array with 3 dimensions (for example, array x has dimensions[91, 41, 33] ), and then concatinate it to the previous array. (ex. array=[array, x]).
>
> Lets say we run through the loop 16 times. What I'd like as a result is something that has dimensions like this [16, 91, 41, 33].
>
> I'm not sure how to do this... I've looked at IDL coyote's concatenation tutorial, and still am having trouble.
>
> I'm pretty new to coding period, so this is a challenge. Any ideas?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: n Number of output files
Next Topic: Filtering based on Hessian Matrix

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

Current Time: Wed Oct 08 20:05:46 PDT 2025

Total time taken to generate the page: 0.39335 seconds