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

Home » Public Forums » archive » Re: select first n elements of array without loop
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: select first n elements of array without loop [message #72016] Wed, 04 August 2010 14:33
Fermiona Fermiona is currently offline  Fermiona Fermiona
Messages: 17
Registered: June 2010
Junior Member
Super, thank you!!
Re: select first n elements of array without loop [message #72017 is a reply to message #72016] Wed, 04 August 2010 13:11 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Aug 4, 5:06 pm, David Fanning <n...@dfanning.com> wrote:
> Fermiona Fermiona writes:
>> If I have an array and I want to select say, the first n elements
>> thereof, can I do so without using a loop.
>
>> For example if I want to select all the elements, I'd use an *
>
> subarrar = array[0:n]

Though that selects the first n+1 elements.
Re: select first n elements of array without loop [message #72018 is a reply to message #72017] Wed, 04 August 2010 13:06 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fermiona Fermiona writes:

> If I have an array and I want to select say, the first n elements
> thereof, can I do so without using a loop.
>
> For example if I want to select all the elements, I'd use an *

subarrar = array[0:n]

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to increase array size by 1
Next Topic: Setting UNIX 'group' from IDL?

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

Current Time: Fri Oct 10 16:09:10 PDT 2025

Total time taken to generate the page: 1.04011 seconds