help-octave
[Top][All Lists]
Advanced

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

Re: Filtering


From: Francesco Potorti`
Subject: Re: Filtering
Date: Mon, 28 Feb 2005 18:39:15 +0100

octave> a=[0 1 0]
a =

  0  1  0

octave> b=logical(a)
b =

  0  1  0

octave> [5 6 7](a)
error: invalid vector index = 0
octave> [5 6 7](b)
ans = 6

octave> isbool(a)
ans = 0
octave> isbool(b)
ans = 1

Wow!  This looks significant to me, and now I understand some strange
behaviour I observed in the past.

So, in the example above, a and b are in fact different, and from the
output of whos I see that each bool value occupies one byte.  However,
when used with arithmetic operators, boolean are promoted to numeric.

So, boolean values can be used as 1-0 matrix indices, and they occupy
only one byte per element, rather than eight.  Are these the only
differences between numeric and boolean values?

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 313 8091
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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