[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59191] Using (end+1) on an empty matrix refer
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #59191] Using (end+1) on an empty matrix refers causes unexpected padding with zeros |
Date: |
Sun, 27 Sep 2020 14:01:48 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 Edg/85.0.564.63 |
Update of bug #59191 (project octave):
Status: None => Invalid
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
I don't think this is a bug but rather how matrix indexing works in Octave.
(Trailing) singleton dimensions have a size of 1:
>> a = ones (2, 3);
>> [sz1, sz2, sz3] = size (a)
sz1 = 2
sz2 = 3
sz3 = 1
So `end+1` for the third dimension of `a` is 2.
Unassigned values are always initialized with 0:
>> clear b;
>> b(2,3) = 1
b =
0 0 0
0 0 1
Closing as invalid.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59191>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/