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

Home » Public Forums » archive » Orthorectifying Quickbird scenes with RPC files
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: OR [message #70730 is a reply to message #67037] Mon, 03 May 2010 15:04 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 5/3/10 3:55 PM, fgg wrote:
> Hello there,
>
> How can I summarize these two lines in just one line of code?
>
> if (line[0] eq 'i_rng_wf' and n_elements(line) ne 4002) then message,
> $
> 'The # of samples per shot is not valid.'
> if (line[0] eq 'i_rng_wf' and n_elements(line) ne 10882) then message,
> $
> 'The # of samples per shot is not valid.'
>
> ...I thought using OR would do the trick, but I guess I'm missing
> something here:
>
> if (line[0] eq 'i_rng_wf' and n_elements(line) ne (4002 or 10882))
> then message, ...
>
> Thanks

Using the bitwise operators, it would be:

if (line[0] eq 'i_rng_wf' and (n_elements(line) ne 4002 or
n_elements(line) ne 10882) then ...

I would consider using logical operators if you only have to be IDL 6.0+
compatible:

if (line[0] eq 'i_rng_wf' && (n_elements(line) ne 4002 ||
n_elements(line) ne 10882) then ...

The logical operators will short-circuit.

-Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Evaluate a string as a variable name
Next Topic: pointer to object confusion (C++ programmer, IDL n00b)

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

Current Time: Sat Oct 11 05:37:16 PDT 2025

Total time taken to generate the page: 0.08256 seconds