[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58151] find(1:3, list) returns indices greate
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #58151] find(1:3, list) returns indices greater than length(list) |
Date: |
Thu, 9 Apr 2020 22:44:48 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Update of bug #58151 (project octave):
Status: None => Invalid
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
This is expected, and the same behavior as Matlab. The crux of the issue is
that you are performing an operation between a row vector and column vector
and so "broadcasting" applies and Octave/Matlab fill in the values to create a
matrix.
For example
octave:1> x = 1:3
x =
1 2 3
octave:2> y = x'
y =
1
2
3
octave:3> z = x + y
z =
2 3 4
3 4 5
4 5 6
In this case, 2:4 becomes the row vector [2, 3, 4], and you are using the '=='
operator between in and a column vector of length 5556 which should create a
matrix of size 5556 x 3. You could always check with
tst = (2:4 == day);
size (tst)
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58151>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/