help-octave
[Top][All Lists]

## comparison operators

 From: Fabian Alvarez Subject: comparison operators Date: Wed, 20 Mar 2002 15:26:30 +0100

```Hello,

sorry if this is a to stupid question, but I read the manual and
played around a long time and I can't find if the result I get is a
bug or a feature :)

for any vector, i.e.:

octave:1> a = rand (1,5)
a =

0.14714  0.46226  0.85053  0.59390  0.47820

octave:2> a ( a < 0.8 )
ans =

0.14714  0.46226  0.59390  0.47820

which seems great, but checking against a value which is greater or
lower than all the elements of the vector gives this result:

octave:3> a ( a < 0.9 )
ans =

0.14714  0.14714  0.14714  0.14714  0.14714

octave:4> a ( a > 0.1 )
ans =

0.14714  0.14714  0.14714  0.14714  0.14714
I checked for several examples, and it always results in the first
value of  'a' repeated along the whole vector.

nevertheless, I think that the correct result should be the original
vector 'a' with its five different components.

any insight on this problem?

thank you very much,

Fabián

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```