Parse error when defining a cell array
John W. Eaton
jwe at octave.org
Mon Jan 12 23:01:04 CST 2009
On 6-Dec-2008, Jan Albersmeyer wrote:
| Bug report for Octave 3.0.1 configured for i686-pc-linux-gnu
|
| Description:
| -----------
|
| It seems that the call to the "eye" function is not handled correctly
| while defining a cell array.
|
|
| Repeat-By:
| ---------
|
| This is how I would expect Octave to work, and in this case it does fine.
|
| octave:1> e = { 0, eye(5) }
| e =
|
| {
| [1,1] = 0
| [1,2] =
|
| 1 0 0 0 0
| 0 1 0 0 0
| 0 0 1 0 0
| 0 0 0 1 0
| 0 0 0 0 1
|
| }
|
| Here, a whitespace is inserted between eye and its argument, leading to
| irritating results:
|
| octave:2> e = { 0, eye (5) }
| e =
|
| {
| [1,1] = 0
| [1,2] = 1
| [1,3] = 5
| }
|
| When used the call "standalone", Octave does not care about the whitespace:
|
| octave:3> e = eye (5)
| e =
|
| 1 0 0 0 0
| 0 1 0 0 0
| 0 0 1 0 0
| 0 0 0 1 0
| 0 0 0 0 1
This behavior is intentional, for compatibility with the other leading
brand. It is documented in the "Matrices" section of the Octave
manual. I suppose there should also be some mention of this in the
seciton on cell arrays since similar rules about whitespace apply for
cell arrays and matrices.
jwe
More information about the Bug-octave
mailing list