octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #37132] Parse error with cell arrays


From: Guillaume
Subject: [Octave-bug-tracker] [bug #37132] Parse error with cell arrays
Date: Fri, 17 Aug 2012 15:00:35 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1

URL:
  <http://savannah.gnu.org/bugs/?37132>

                 Summary: Parse error with cell arrays
                 Project: GNU Octave
            Submitted by: gyom
            Submitted on: Fri 17 Aug 2012 03:00:35 PM GMT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Guillaume
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

With MATLAB:

>> a={
{
1
2
}
{
2
3
}
}

a = 
    {2x1 cell}
    {2x1 cell}


With Octave:

octave> {
> {
> 1
> 2
> }
> {
> 2
> 3
parse error:

  syntax error

>>> 3
    ^


Arguably, the correct syntax might be:

octave:86> a={
> {
> 1;
> 2
> }
> {
> 2;
> 3
> }
> }
a = 
{
  [1,1] = 
  {
    [1,1] =  1
    [2,1] =  2
  }
  [2,1] = 
  {
    [1,1] =  2
    [2,1] =  3
  }
}


or

octave:91> {
> {
> 1
> 2
> };
> {
> 2
> 3
> }
> }
ans = 
{
  [1,1] = 
  {
    [1,1] =  1
    [2,1] =  2
  }
  [2,1] = 
  {
    [1,1] =  2
    [2,1] =  3
  }
}


but I'm still unsure whether the difference in behaviour is due to MATLAB
accepting an invalid syntax or a bug in the Octave parser.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37132>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]