Re: behavior of arrays [message #15430] |
Wed, 19 May 1999 00:00  |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
I do not quite realize what is the point in this exercise. FLTARR(10,1)
is an array with 10 columns and 1 row (which all is meaningful only in
the direction of array operations which in IDL is row-wise). Therefore,
seems to me that FLTARR(10, 1) is the same as FLTARR(10) to begin with
(unlike FLTARR(1, 10)). If you anticipate expanding the matrix, its easy
to do by using TRANSPOSE and subscripts. I have never experienced a
problem with losing or mixing up dimensions, although most of my data
are matrices. In the example below, I see no loss of information in the
transition from d to c. If you defined more than 1 row, C would be 2D
in the last statement.
Cheers,
Pavel
"R.Bauer" wrote:
> 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.
>
> R.Bauer
>
> 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]
>
> c=b.d
> help,c
> ; C FLOAT = Array[10]
|
|
|