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

Home » Public Forums » archive » Re: IDL removes dimensions of size 1 automatically
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: IDL removes dimensions of size 1 automatically [message #41190 is a reply to message #41189] Fri, 24 September 2004 11:14 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Benjamin Hornberger wrote:
> Hi all,
>
> I had a hard time finding a bug which came from IDL's behaviour to
> remove dimensions of size 1 automatically sometimes.
>
> IDL> a=[[1u,1u]]
> IDL> help,a
> A UINT = Array[2]
> IDL> ;; IDL doesn't even let me specify this (2,1) element array
> IDL> a=reform(a,2,1)
> IDL> help,a
> A UINT = Array[2, 1]
> IDL> b=fix(a)
> IDL> help,b
> B INT = Array[2]
> IDL> ;; IDL removed my second dimension even though I just wanted to
> change the type
> IDL> c=2*a
> IDL> help,c
> C INT = Array[2]
> IDL> print,c
> 2 2
> IDL> ;; again IDL kicked out my second dimension
>
> I found this very annoying. Does anyone know more about it? Why is it
> like that? In which situations will IDL do that?

Only trailing dimensions of size 1 are removed.

IDL> x=fltarr(20,1,1,1,1)
IDL> help, x
X FLOAT = Array[20]
IDL> x=fltarr(1,1,1,1,20)
IDL> help, x
X FLOAT = Array[1, 1, 1, 1, 20]
IDL> x=fltarr(20,1,3,1,1)
IDL> help, x
X FLOAT = Array[20, 1, 3]

This has always been the case (in my experience) - much to the consternation of some IDL
users, and to the joy to others. YMMV.

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: memory/buffer overload?
Next Topic: anonymous structure as member of named event structure

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

Current Time: Sun Oct 12 00:51:51 PDT 2025

Total time taken to generate the page: 1.12222 seconds