[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51633] Empty indexing of struct returns empty
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #51633] Empty indexing of struct returns empty struct array |
Date: |
Mon, 7 Aug 2017 11:51:53 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0 |
Update of bug #51633 (project octave):
Status: None => Confirmed
_______________________________________________________
Follow-up Comment #9:
Marking as confirmed. The issue seems to be that an empty indexing expression
for structs is interpreted as indexing with a null array.
Sample Code:
octave:9> s = struct ("x", 1:10)
s =
scalar structure containing the fields:
x =
1 2 3 4 5 6 7 8 9 10
octave:10> s()
ans =
0x0 struct array containing the fields:
x
octave:11> s([])
ans =
0x0 struct array containing the fields:
x
octave:12> s(1)
ans =
scalar structure containing the fields:
x =
1 2 3 4 5 6 7 8 9 10
Conversely, for Arrays no index expression means perform no indexing operation
at all.
octave:13> r = [1:10]
r =
1 2 3 4 5 6 7 8 9 10
octave:14> r()
ans =
1 2 3 4 5 6 7 8 9 10
octave:15> r([])
ans = [](0x0)
octave:16> r(1)
ans = 1
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51633>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/