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

Home » Public Forums » archive » Array index bug....
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Array index bug.... [message #14328] Sun, 21 February 1999 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
Try this:

data = transpose([[[dist(50)]],[[dist(50)]]],[2,0,1])
help,data
; DATA FLOAT = Array[2, 50, 50]

tvscl,data(0,*,*) ;; Shows the expected image...

But, imagine that you're writing a general program that must
accept arrays with any number of dimensions, and extract data
from the array in (n-1)-dimensional "slices" like the
above. Short of having a CASE statement for every extraction
of data from the array, the way to do this is e.g.:

tvscl,data(0,*,*,*,*) ;; Shows the expected image in this case,
;; works for up to 5 dimensions (though
;; I don't know what TVSCL would say about
;; that!)

Now, IDL *claims* to handle up to 8 dimensions, so one would think
the best thing is to prepare your code for it, e.g.:

tvscl,data(0,*,*,*,*,*,*,*)

The image is *not* what you expect! Clearly something breaks
down with the eighth dimension.....

Another matter is, how do you create e.g., 4-dimensional data
sets with the concatenation style? Lets see:

IDL> help,[1,2]
<Expression> INT = Array[2]
IDL> help,[[1],[2]]
<Expression> INT = Array[1, 2]
IDL> help,[[[1]],[[2]]]
<Expression> INT = Array[1, 1, 2]
IDL> help,[[[[1]]],[[[2]]]]

help,[[[[1]]],[[[2]]]]
^
% Only eight levels of variable concatenation are allowed.

Hmm. Very strange indeed, since I don't even have 8 opening
(or closing) brackets in total, much less anything going to
what *I* would interpret as 8 levels of concatenation....

Regards,

Stein Vidar
[Message index]
 
Read Message
Read Message
Previous Topic: NNLS algorithm
Next Topic: Keyword bug in CW_BGROUP??

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

Current Time: Wed Oct 08 19:31:33 PDT 2025

Total time taken to generate the page: 0.00211 seconds