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

Home » Public Forums » archive » Re: 'IN' statement in IDL
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: 'IN' statement in IDL [message #5342] Tue, 07 November 1995 00:00
korpela is currently offline  korpela
Messages: 59
Registered: September 1993
Member
In article <Pine.A32.3.91.951107091912.26059B-100000@zeus.cc.ucy.ac.cy>,
Frank Schnorrenberg <csfranks@zeus.cc.ucy.ac.cy> wrote:
>
> colors=['negative','weak','moderate','strong','very strong']
> FOR I=0, N_ELEMENTS(db) DO BEGIN
> FOR color IN colors DO BEGIN
>
> IF db(I).Color EQ color THEN ....
>
> ENDFOR
> ENDFOR
>

Maybe I don't quite understand what you're trying to do, but it seems
that the above code could be easily rewritten as:

------------------------------------------------------------ ------------
colors=['negative','weak','moderate','strong','very strong']
FOR I=0, N_ELEMENTS(db)-1 DO BEGIN
FOR J=0,N_ELEMENTS(colors)-1 DO BEGIN

IF db(I).Color EQ colors(J) THEN ....

ENDFOR
ENDFOR
------------------------------------------------------------ -------------


Personally, I would probably write it as:

------------------------------------------------------------ -------------
colors=['negative','weak','moderate','strong','very strong']
FOR I=0, N_ELEMENTS(db)-1 DO BEGIN
J=WHERE(colors eq db(I).Color)
if (J ne -1) THEN ....
ENDFOR
------------------------------------------------------------ -------------

Eric
--
Eric Korpela | An object at rest can never be
korpela@ssl.berkeley.edu | stopped.
<a href=" http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpe la/w">
Click here for more info.</a>
[Message index]
 
Read Message
Previous Topic: CALL_EXTERNAL - Fortran Troubles
Next Topic: Precompiling routines?

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

Current Time: Wed Oct 08 19:43:01 PDT 2025

Total time taken to generate the page: 0.00460 seconds