[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #48064] for-loop over structure elements behav
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #48064] for-loop over structure elements behaves differently from document |
Date: |
Tue, 31 May 2016 09:34:09 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.8.0 |
URL:
<http://savannah.gnu.org/bugs/?48064>
Summary: for-loop over structure elements behaves differently
from document
Project: GNU Octave
Submitted by: None
Submitted on: Tue 31 May 2016 09:34:06 AM UTC
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name: Wang S
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 4.0.2
Operating System: GNU/Linux
_______________________________________________________
Details:
PDF documentation says that
"The key variable may also be omitted. If it is, the brackets are also
optional."
in section 10.5.1 Looping Over Structure Elements, page 168.
But the behavior is as follow
octave:1> clear all; x.a=1; x.b=[1,2;3,4]; x.c="string"; for [val,key]=x, key,
val, endfor
key = a
val = 1
key = b
val =
1 2
3 4
key = c
val = string
OK
octave:2> clear all; x.a=1; x.b=[1,2;3,4]; x.c="string"; for [~,key]=x, key,
endfor
key = a
key = b
key = c
OK
octave:3> clear all; x.a=1; x.b=[1,2;3,4]; x.c="string"; for [val,~]=x, val,
endfor
val = 1
val =
1 2
3 4
val = string
OK
octave:4> clear all; x.a=1; x.b=[1,2;3,4]; x.c="string"; for [val]=x, val,
endfor
val =
scalar structure containing the fields:
a = 1
b =
1 2
3 4
c = string
cannot loop over elements
octave:5> clear all; x.a=1; x.b=[1,2;3,4]; x.c="string"; for val=x, val,
endfor
val =
scalar structure containing the fields:
a = 1
b =
1 2
3 4
c = string
cannot loop over elements
Which is correct, the behavior or the document?
System information:
octave:6> ver
----------------------------------------------------------------------
GNU Octave Version: 4.0.2
GNU Octave License: GNU General Public License
Operating System: Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2
(2016-04-08) x86_64
and Debian package status:
ii liboctave3:amd64 4.0.2-1~bpo8+1 amd64
ii octave 4.0.2-1~bpo8+1 amd64
ii octave-common 4.0.2-1~bpo8+1 all
ii octave-doc 4.0.2-1~bpo8+1 all
ii octave-info 4.0.2-1~bpo8+1 all
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?48064>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #48064] for-loop over structure elements behaves differently from document,
anonymous <=