help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advanced logical operators?


From: David Grundberg
Subject: Re: Advanced logical operators?
Date: Sun, 21 Feb 2010 21:24:05 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

forkandwait skrev:
Hi all,

Are there any advanced logical operators, especially for the effect of "in" and "between"?
I would like to write the following

iages = find (ages == 0 | ages == 1 | (ages >=20 & ages <=30) | ages == 65);

as iages = find (ages INOP [0 1 65] | ages BETWEENOP [20 30]) or some such. Advice? Maybe I am out of luck? Maybe I shouldn't have such a syntactic sweet tooth?...

If the ages are all integers, you could do:

ismember (ages, [0, 1, 20:30, 65])

hth,
David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]