How to use the OO features of Octave

David Bateman dbateman at dbateman.org
Tue Sep 23 16:17:36 CDT 2008


John W. Eaton wrote:
> On 23-Sep-2008, David Bateman wrote:
>
> | David Bateman wrote:
> | > John W. Eaton wrote:
> | > >
> | > >      args(2) = num_indices;
> | > >      args(1) = index_position;
> | > >      args(0) = *indexed_object;
> | >
> | >
> | > shouldn't args(1) be
> | >
> | > args(1) = index_position + 1;
> | >
> | > due to the 1-based indexing of Octave?
>
> Yes, I've fixed this now.  Thanks.
>   

Ok.
> | Also shouldn't we subtract one from the return value of the feval call?
>
> I don't think so, because the result is not used directly in C++, but
> it replaces the value in the expression where the "end" keyword
> appears.  So in your example, for a(2:end) and a(2:4) to be
> equivalent, the value returned from the __end__ function must be 4
> (== numel(obj.x), I think), not 3.
>   
Yes I noticed after I sent my mail. However the indexing like a(1,1:end) 
or a(1,:) as s.subs in subsref is passed a scalar value and not a vector 
or matrix as expected.

D.



> jwe
>   


-- 
David Bateman                                dbateman at dbateman.org
35 rue Gambetta                              +33 1 46 04 02 18 (Home) 
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob) 



More information about the Octave-maintainers mailing list