[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: behavior of arrays




Don't get me started on this again.  You can find my recent tirade on
this subject under "dropped dimensions" on dejanews.com.

For the case of your structure, I think that b.d is *actually* still a
10x1 array, but any access to it will cause IDL to automatically
collapse the degenerate dimension in the expression.  Therefore, even
HELP thinks that it is a 10-vector, not a 10x1 array.

Practically speaking, you will need to REFORM() your array whenever
you need to use it.

Craig

"R.Bauer" <R.Bauer@fz-juelich.de> writes:

> 
> I have some problems to understand the logic which may be behind the
> handling of an array
> like defined.
> 
> Why is the result help, b.d  only [10] and not [10,1] ?
> 
> This means I will lose the information that's it is / was a 2-dim
> dataset.
...
> d=reform(findgen(10),10,1)
> help,d
> ;D               FLOAT     = Array[10, 1]
> 
> b=create_struct('d',d)
> help,b,/str
> 
> ;** Structure <1348428>, 1 tags, length=40, refs=1:
> ;   D               FLOAT     Array[10, 1]
> 
> 
> help,b.d
> ; <Expression>    FLOAT     = Array[10]

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------