octave-maintainers
[Top][All Lists]
Advanced

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

Re: How to use the OO features of Octave


From: John W. Eaton
Subject: Re: How to use the OO features of Octave
Date: Fri, 26 Sep 2008 15:49:11 -0400

On 24-Sep-2008, David Bateman wrote:

| Yes I got it to work, but the polynomial example class in the document
| 
| pre-version_7.6_oop.pdf
| 
| from mathworks seems to suggest that the way I wrote it should work as well.

I see the example, but I don't see how

  ind = s.subs{:};
  some_value (ind);

can do the right thing if s.subs is a cell array with more than one
element.  In that case, both Matlab and Octave will only assign the
first value of the comma-separated list that the s.subs{:} expression
produces to ind.  Is this just a case of sloppy programming in the
subsref.m method of the example polynom class, because they "know"
that it will only ever be called with 1 subscript?  In that case, when
they write

  ind = s.subs{:};

ind might be a vector of values corresponding to the (only) subscript
(for example, in an expression like p([1,2,3]), it will have the value
[1,2,3]) and not a list of separate subscripts, so that the subsequent

  for k = 1:length (ind)

is looping over the elements of the index vector, not the subscripts.  

jwe


reply via email to

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