I'm converting a class in Matlab 2008 from a group of m files in an @className folder, and have run into issues trying to take the individual methods within the subsref file and make them into their own methods for the class. Specifically I can get them to work, so long as there are no indexed array calls to these methods from subsref. I cannot get around no longer supporting the indexed array access to subsref methods, as it would require too much time to enact in other portions of the code base. Is there any way to make indexed array access work and be able to pull the methods out of subsref?
Implementing expressions of the form
T.geo( end, : )
is not possible when "geo" is a class method. Note that that is only true, however, because of the presence of colon expansions ':' and 'end' statements. If your indices will always be purely numeric, like in the following
then doing this through a class method called geo() is perfectly feasible.
Since you seem to want to use colons and "end"'s, one thing you might do is make "geo" a Dependent property (or maybe even a non-dependent one) that returns the matrix to be indexed. If you use a Dependent property, however, the class method set.geo() will have to construct the full matrix to be indexed, regardless of whether you only intend to extract a piece of it. If this is the very thing you were trying to avoid, you must use an overloaded SUBSREF, as in the original implementation.