help-octave
[Top][All Lists]
Advanced

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

Re: struct weirdness


From: Sergei Steshenko
Subject: Re: struct weirdness
Date: Sat, 25 Aug 2012 12:33:43 -0700 (PDT)


--- On Fri, 8/24/12, Jordi Gutiérrez Hermoso <address@hidden> wrote:

> From: Jordi Gutiérrez Hermoso <address@hidden>
> Subject: Re: struct weirdness
> To: "Sergei Steshenko" <address@hidden>
> Cc: "Ben Abbott" <address@hidden>, "John W. Eaton" <address@hidden>, 
> "address@hidden" <address@hidden>
> Date: Friday, August 24, 2012, 9:14 AM
> On 24 August 2012 11:02, Sergei
> Steshenko <address@hidden>
> wrote:
> > Matlab/Octave behavior in case of 'struct' contradicts
> behavior of Perl/Python/C++/etc.
> >
> > I.e. Matlab/Octave _discard_ the type I wanted it use
> by specifying '[...]', and even a warning isn't issued.
> 
> You've had this conceptual problem before. I have it too
> sometimes.
> The fundamental issue is that there is an intermediate,
> internal type
> called "cs-list" that isn't exposed in the interpreter
> except in
> obscure ways. You can't assign a cs-list to a variable, but
> you can
> obtain one in several ways from struct and cell arrays.
> 
> - Jordi G. H.
> 

where is a conceptual problem ? Here is a screen session:

"
octave:1> foo.cellarray = {"Peter", "Paul", "Mary"};
octave:2> foo.vector = [1 2 3 4];
octave:3> foo.matrix = [5 6 7; 8 9 10];
octave:4> foo.scala_value = 123;
octave:5> foo
foo =

  scalar structure containing the fields:

    cellarray = 
    {
      [1,1] = Peter
      [1,2] = Paul
      [1,3] = Mary
    }
    vector =

       1   2   3   4

    matrix =

        5    6    7
        8    9   10

    scala_value =  123

octave:6> 
"
- everything works as expected, the way it works in Perl/Python/C++, the 
intended types are preserved.

Regards,
  Sergei.



reply via email to

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