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

Home » Public Forums » archive » REFORM: new subscripts must not change the number elements in array
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: REFORM: new subscripts must not change the number elements in array [message #90425 is a reply to message #90424] Mon, 02 March 2015 09:01 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, March 2, 2015 at 5:46:52 PM UTC+1, g.na...@gmail.com wrote:
> I didn't understand the logic of this reform(a, 100l, 200l*2l).
> If instead of A=[200,200] we have A=[216,216] and we want 120x(216x216) then this is written as reform(a, 120l, 216l*2l). Is that correct?
>
> I am trying to understand how you end up with reform(a, 100l, 200l*2l). Because when I typed this
> a = randomu(s, 216,216)
> help, reform(a, 120l, 216l*2l,/overwrite)
> I got the same error "REFORM: New subscripts must not change the number elements in A."

Look, it's getting difficult to help if the cards keep on changing.
Did you see my last message? You can do the same thing without using reform(), because I think you have not read the documentation of the reform command.

xSize = 216
ySize = 216
nImages = 120
finalArray = fltarr(xSize,ySize,nImages)
for i=0, nImages-1 do begin
;generate the array
a = randomu(s,xSize,ySize)
;put it in the final array
finalArray[0,0,i] = a
endfor

I didn't use the reform. For your information this:
finalArray[0,0,i] = a
is the same as this:
finalArray[*,*,i] = a
Just a bit faster.

As an example, try this:
test = fltarr(3,3,5)
print, test
ones = fltarr(3,3)+1.0
test[0,0,2] = ones
print, test

Test contains 5 "images" of 3x3 pixels. When you first print it, you will see 5 images with zeros in each pixel. After
test[0,0,2] = ones
you will find that the third image is filled with ones.

I think this is described here:
http://www.exelisvis.com/docs/Array_Subscript_Ranges.html
in the section "Avoid using range subscripts for assignment".

Cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: function graphics event handling
Next Topic: Image in color scale and gray level scale.

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

Current Time: Wed Oct 08 19:56:42 PDT 2025

Total time taken to generate the page: 0.29192 seconds