|
I want to use a setter function in the following manner:
set(C,C.pn,C.pv)
C is an object that inherits handle and hgsetget, C.pn is a 1x3 cell array of strings referencing properties of C and C.pv is an array of values to which i would like to set the properties in C.pn. Parameters, pv and pn are public properties of C.
here's the kicker, the property of C that I am referencing with the strings is a structure and the values I am trying to set are fields of that structure. MATLAB gives a 'property does not exist' error when the command executes. Here are some more details:
parameters is a public property of object C
C.pn = {'parameters.sub1.sub2.a' 'parameters.sub1.sub2.b','parameters.sub1.d'}
C.pv = [1,3,pi]
Again, the error is occurring because the set function does not recognize that parameters is a structure with multiple substructures and so it tries to set a field named C.parameters.sub1.sub2.a equal to 1 while the public property in C is just straight up "parameters".
How can I adjust this update relationship to recognize the subfields?
|