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

Home » Public Forums » archive » Re: Array slices
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: Array slices [message #47247] Thu, 02 February 2006 08:58 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Richard Edgar writes:

> I'm having trouble with slices of 3D arrays in IDL, and I suspect that
> it's something I don't understand about the way IDL interprets things.
> My problem can be summed up as follows:
>
> IDL> arr=DINDGEN(3,3,3)
> IDL> help,arr
> ARR DOUBLE = Array[3, 3, 3]
> IDL> help,arr[*,*,1]
> <Expression> DOUBLE = Array[3, 3]
> IDL> help,arr[*,1,*]
> <Expression> DOUBLE = Array[3, 1, 3]
> IDL> help,arr[1,*,*]
> <Expression> DOUBLE = Array[1, 3, 3]
>
> My questions are:
> a) Why don't all three slices return a [3,3] array?
> b) How do I eliminate the 'useless' dimension?
>
> I typically have routines which want a 2D array, which I only get from
> the first of these. They (naturally) choke when given a 3D array, one of
> whose dimensions is unity.

One man's "useless" dimension is another man's "essential"
dimension, as you will learn if you follow this newsgroup
for any length of time. The lamentations over the "missing"
dimension are legendary.

But, if it is really useless to you, then REFORM it away:

IDL> Help, Reform(array[3,1,3], 3, 3)
<Expression> DOUBLE = Array[3, 3]

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: display line numbers in idlde?
Next Topic: Re: Speeding up multiple file reading

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

Current Time: Fri Oct 10 07:08:44 PDT 2025

Total time taken to generate the page: 0.79822 seconds