[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60816] In a user created function if i pass a
From: |
Dmitri A. Sergatskov |
Subject: |
[Octave-bug-tracker] [bug #60816] In a user created function if i pass a vector it is incorrectly evaluated |
Date: |
Wed, 23 Jun 2021 23:14:26 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
Follow-up Comment #1, bug #60816 (project octave):
if (x<=3) is not what you think it is.
>From "help if":
<<<
The conditional COND is true if it is not empty and if _all_ values are
nonzero.
>>>
octave:9> x = linspace(0, 6, 9)
x =
Columns 1 through 8:
0 0.7500 1.5000 2.2500 3.0000 3.7500 4.5000 5.2500
Column 9:
6.0000
octave:10> x<=3
ans =
1 1 1 1 1 0 0 0 0
so if(x<=3) goes to the "else" branch for this x vector.
Dmitri.
--
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60816>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/