Re: REFORM: new subscripts must not change the number elements in array [message #90423 is a reply to message #90416] |
Mon, 02 March 2015 08:24   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Monday, March 2, 2015 at 4:43:17 PM UTC+1, g.na...@gmail.com wrote:
> There is one thing I don't understand. Both of you suggest the same thing:
> a = reform(a, 100l, 200l*2l, /overwrite)
> You typed 200l*2l this is because we want 200x200 that's why you multiplied it by 2?
> What I want it's 100 x (200x200). So 100 2D images of dimensions [200,200]
Ok, so before, I didn't see this message.
You're sort of changing things around here.
You started from ONE array with 200x200 elements and wanted to make something of 100x(40000) elements. This of course will never work.
What you really want is to make a 100x200x200 array from 100 arrays of 200x200. Correct?
But where do you get the 100 arrays of 200x200?
Try this:
finalArray = fltarr(100,200,200)
for i=0, 99 do begin
;generate the array
a = randomu(s,200,200)
;put it in the final array
finalArray[i,0,0] = reform(a,1,200,200)
endfor
Regards,
Helder
|
|
|