I'm not sure I understand fully what you're asking, particularly as you're not using correct terms. There are no structures, fields or subfields in any of the code you've shown (and I've no idea what you mean by output subfield). An object has properties (and methods, and optionally events).
The properties of an objects are defined in the classdef block. While there is a way to have dynamic properties in matlab it's a fairly advanced form of programming which I wouldn't recommend. For the common case the properties are set by the class and the user of the class cannot create more properties.
Also note that in the example you've shown the addData method is not particularly useful since the property is public (i.e. can be modified by users of the class). You could simply bypass it and do:
o = myData;
o.Data = o.Data + val;
I'm not sure what it is you're trying to do. What is your ultimate goal?
Best Answer