using classdef, is it possible to mix run-time data access through the dot syntax with methods elegantly?
4 views (last 30 days)
i am developing a class (using classdef) that maintains a structure internally with fields that are instance-dependent. i want to provide direct access to these instance-dependent fields through object.fieldname syntax, so i use subsref and override fieldnames() so that tab completion works correctly.
trouble is, now all methods called using the syntax object.method() also result in calls to subsref, so i have to provide a case in subsref for every method of the class. this seems inelegant at best, and error prone at worst.
is there another way to achieve what i want?