Convert an object to an index vector. When a is a class object defined with a class constructor, then
subsindex
is the overloading method that allows the conversion of this class object to a valid indexing vector. It is important to note thatsubsindex
must return a zero-based real integer vector of the class "double". For example, if the class constructorfunction b = myclass (a) b = myclass (struct ("a", a), "myclass"); endfunctionthen the
subsindex
functionfunction idx = subsindex (a) idx = double (a.a) - 1.0; endfunctioncan then be used as follows
a = myclass (1:4); b = 1:10; b(a) 1 2 3 4