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 #41183 is a reply to message #41179] Sun, 26 September 2004 01:36 Go to previous messageGo to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
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?
>
> Thanks for any comments,
>
> Benjamin


Dear Benjamin

this is regular discussed here. It's not a bug because this is described in
all documents about array handling from RSI.

I have had a lot of problems by this too. You could do a feature request to
to get a compiler option implemented which controls this too.

Here are an additional examples about this:

IDL> c=reform(make_array(10,1),10,1)
IDL> help,c
C FLOAT = Array[10, 1]
IDL> D=C
IDL> help,D
D FLOAT = Array[10]

The solution is:
IDL> c=reform(make_array(10,1),10,1)
IDL> s=size(c,/dim)
IDL> d=reform(c,s)
IDL> help,d
D FLOAT = Array[10, 1]


Reimar


--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
[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 10:39:26 PDT 2025

Total time taken to generate the page: 2.38286 seconds