Re: Automatic truncation of trailing dimension..... [message #28263 is a reply to message #28262] |
Tue, 27 November 2001 13:32   |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Paul van Delst wrote:
>
> .....of an array when the dimension size is 1 is a real pain in the ass. Given:
>
> IDL> x=fltarr(100,1,15)
> IDL> help, x
> X FLOAT = Array[100, 1, 15]
>
> Is there anyway to prevent:
>
> IDL> help, x[*,*,1]
> <Expression> FLOAT = Array[100]
> IDL>
>
> i.e. to give:
> <Expression> FLOAT = Array[100,1]
>
> Argh wot a pain.
I take it you mean
<Expression> FLOAT = Array[100, 1, 1]
Does your code absolutely require it? In many cases, you can use the two
interchangeably.
If you must maintain the dimensions:
IDL> dims = size(x, /dimensions)
IDL> index = 1
IDL> help, reform(x[*, *, index], dims[0], dims[1], 1)
<Expression> FLOAT = Array[100, 1, 1]
Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
|
|
|