Re: REFORM: new subscripts must not change the number elements in array [message #90443 is a reply to message #90427] |
Mon, 02 March 2015 23:26   |
Moritz Fischer
Messages: 32 Registered: June 2013
|
Member |
|
|
Am 02.03.2015 um 18:12 schrieb g.nacarts@gmail.com:
> Yes, I saw your last message but I am interested to understand how you end up before with the a = reform(a, 100l, 200l*2l, /overwrite).
Ok, let's try again.
What does reform do?
It changes the arrangement of the array elements. Not its total number.
In your initial example you had an array of 200 by 200 elements (40,000
in total), and you *can* reaarrange the elements of such an array to an
100 by 400 element array (also 40,000 in total), that is why I gave that
example.
Helder picked the same example by chance, I might as well have suggested
to reform it to 64 by 625 elements (also 40,000 in total).
Or to 100 by 16 by 25 elements.
> Then I tried to write it like this:
> a = reform(a, 120l, 216l*2l, /overwrite)
> but I got the error that I mentioned before.
Check the total element number: 120 by 216*2 = 120 by 432 = 51840
Your initial array randumu(s,216,216) has 216 by 216 = 46656 elements.
You say you want to go from 216x216 to 100x216x216.
You cannot do this with reform.
But of course you can do it differently. That would depend on what you
want to look the new array like. (Copies of the original, different data
of the same size, you name it. But do name it.)
|
|
|