[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Changeset] ismethod and subsindex functions
From: |
John W. Eaton |
Subject: |
[Changeset] ismethod and subsindex functions |
Date: |
Fri, 26 Sep 2008 13:30:17 -0400 |
On 26-Sep-2008, David Bateman wrote:
| In my effort to look at documenting, and testing at the same time, the
| new OOP fetaures, here is a patch that adds the subsindex and ismethod
| functions. The subsindex function allows the conversion of a class
| object into a valid index vector for use in indexing expressions. That
| is something like
|
| a = myclass (1:4);
| b = 1:10;
| c = b (a)
|
| the conversion of a to an index of b is handled by the subsindex method
| of the class. Note that Mathworks, in their wisdom or lack there of,
| decided that subsindex should be a zero-based index where indexing
| everywhere else in the matlab language is ones-based!!!!! And so
| subsindex must return a zero-based index vector of the class double/logical.
|
| The ismethod function is just the same function as in matlab as I
| implemented as it was easy enough to add.
Thanks, I applied this changeset.
| Note that I'm seeing some strange things with this patch in the same
| manner as I saw previously for the thread
|
| http://www.nabble.com/Another-OOP-issue-to19638982.html
|
| That is
|
| a = myclass (1:4);
| b = 1:10;
| c = b (a)
|
| works, but then an additional call to "b(a)" results in the subsindex
| method not being found and the default method being found instead. This
| seems to be a generic issue with the OOP code. However, it is also
| independent of this patch and so perhaps this patch should be applied in
| any case. I believe that with the addition of the subsindex method and
| the vertcat/horzcat overloading in [] that all of the operator
| overloading capabilities are now in place.
OK, I'll try to take a look at this problem.
jwe