[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Index expressions, boolean types and numerical types
From: |
Greg Novak |
Subject: |
Index expressions, boolean types and numerical types |
Date: |
Fri, 24 Oct 2003 15:30:13 -0500 |
Does Octave have boolean types? Does it keep track of them silently? How
do you do casts between numerical types and boolean types? If there are
no boolean types, then how does the following fragment of a session make
sense?
octave:68> y=1:10
y = 1 2 3 4 5 6 7 8 9 10
octave:69> y(y<11)
ans = 1 2 3 4 5 6 7 8 9 10
octave:70> k=y<11
k = 1 1 1 1 1 1 1 1 1 1
octave:71> y(k)
ans = 1 2 3 4 5 6 7 8 9 10
octave:72> k=ones(1,10)
k = 1 1 1 1 1 1 1 1 1 1
octave:73> y(k)
ans = 1 1 1 1 1 1 1 1 1 1
octave:74>
k looks exactly the same when I assign it by k=y<11 or k=ones(1,10), but
the behavior of y(k) is very different in the two cases.
What gives?
Thanks,
Greg
-------------------------------------------------------------
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
-------------------------------------------------------------
- Index expressions, boolean types and numerical types,
Greg Novak <=