@classmethod<EOL><INDENT>def to_value(cls, instance):<DEDENT>
if not isinstance(instance, OctaveUserClass) or not instance._attrs:<EOL><INDENT>return dict()<EOL><DEDENT>dtype = []<EOL>values = []<EOL>for attr in instance._attrs:<EOL><INDENT>dtype.append((str(attr), object))<EOL>values.append(getattr(instance, attr))<EOL><DEDENT>struct = np.array([tuple(values)], dtype)<EOL>return MatlabObject(struct, instance._name)<EOL>
Convert to a value to send to Octave.