[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Filtering
From: |
Hamish Allan |
Subject: |
Filtering |
Date: |
Mon, 28 Feb 2005 13:24:22 +0000 |
Hi,
It seems that matrices returned by comparison operators are 'special',
for example:
octave:1> x = [1 2 3 4 5]
x =
1 2 3 4 5
octave:2> x > 1
ans =
0 1 1 1 1
octave:3> x(ans)
ans =
2 3 4 5
octave:4> ans2 = [0 1 1 1 1]
ans2 =
0 1 1 1 1
octave:5> x(ans2)
error: invalid vector index = 0
octave:5>
Why is this? How else might I achieve what I want to do, which is:
octave:5> x((x > 1) .* (x < 4))
ans =
2 3
octave:6>
Many thanks,
Hamish
-------------------------------------------------------------
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
-------------------------------------------------------------
- Filtering,
Hamish Allan <=