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

Home » Public Forums » archive » Re: Generally accessing the rest of the elements in an array
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: Generally accessing the rest of the elements in an array [message #23781 is a reply to message #23777] Tue, 20 February 2001 16:12 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
"tbowers" <tbowers@nrlssc.navy.mil> writes:

> How do I access the 2nd + dimensions of an array generally, without knowing
> the
> number of higher dims this array has. E.g. say a is a 3 column by
> n-dimensional
> aray, and n is unknown. Here, I'll define it as:

> a = indgen(3,2,4)

> I want the equivalent of (in this case):
> b = (a[0,*,*])^2 + (a[1,*,*])^2 + (a[2,*,*])^2

(rest deleted)

You should be able to do something like the following:

b = a[0,*,*,*,*,*,*,*]^2 + a[1,*,*,*,*,*,*,*]^2 + a[2,*,*,*,*,*,*,*]^2

even though A might not have so many dimensions. With your above example, you
would then get

IDL> help,b
B INT = Array[1, 2, 4]

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Win32 and Removeable Drives
Next Topic: Newsgroup archive online

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

Current Time: Fri Oct 10 18:06:10 PDT 2025

Total time taken to generate the page: 1.36153 seconds