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

Home » Public Forums » archive » Getting rid of loops
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Getting rid of loops [message #18932] Thu, 17 February 2000 00:00 Go to previous message
Jacob Noel-Storr is currently offline  Jacob Noel-Storr
Messages: 1
Registered: February 2000
Junior Member
I am trying to create non-loopy IDL code for a project I am working on.

I have a very long list of integers ('cycle numbers') and I need some way of
creating an array that consists of just the cycle numbers. For example if I
had:

> cycles=[2,2,2,2,2,6,6,7,7,7,9,9,9,27,27,27]

then I would want a function which would do this kid of thing:

> print,fn(cycles)
[2,6,7,9,27]

At the moment this is done by looping through the data twice. Once to count
how many different values there are and once to write the different values
into an array.

Any suggestions about how this could be achieved without the two 'for'
loops?

Thanks,
Jacob

--
Jacob Noel-Storr
Astronomy Department
Columbia University / Biosphere 2 Center
www.astro.bio2.edu/jacob/
jake@astro.columbia.edu
[Message index]
 
Read Message
Read Message
Previous Topic: Problems with the help index
Next Topic: Re: draw text parallel to a sloping line

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

Current Time: Fri Oct 10 21:50:55 PDT 2025

Total time taken to generate the page: 0.56289 seconds