[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: negative indexing of matrix or general access
From: |
Søren Hauberg |
Subject: |
Re: negative indexing of matrix or general access |
Date: |
Wed, 08 Oct 2008 08:31:45 +0200 |
ons, 08 10 2008 kl. 07:58 +0200, skrev Jaroslav Hajek:
> On Tue, Oct 7, 2008 at 10:33 PM, Zbigniew Komarnicki <address@hidden> wrote:
> > Hello,
> >
> > is possible to write a class in OCT file by which I will can make the
> > following access by negative index to a matrix or general access for
> > arbitrary index . For example
> >
> >
> > % this will be create a matrix with zero values (for example by calling a
> > % constructor in C++ code in OCT file)
> > % or
> > % inserting zero values to such matrix (by operator=)
> > A(-3:3, 2:5) = 0
>
> For this to work, you need to modify Octave itself, a package can't
> override Octave's behaviour like that. A package would at least need a
> special object constructor, like
> A = nbizeros(-3:3, 2:5);
> Afterwards, you could happily write
> A(-2:2, 3:5) = whatever
Can't you do this with the object system in the development sources? You
just have to override the functions for the () operator (I think they're
called 'subs'-something...).
Søren