The superclass definition is -
classdef calibration ...
< dynamicprops
properties (SetAccess = immutable)
created = datestr(now, 'yyyymmddTHHMMSS');
author = getenv('username');
end
properties
name = '';
end
properties (SetAccess = protected, Hidden = true)
metaDynProp = [];
end
methods
val = get(obj)
set(obj)
end
methods
function addCal(obj,calName,calVal)
if isscalar(calVal)
caseNum = 1;
elseif isstruct(calVal) && length(calVal) == 4
caseNum = 2;
elseif isstruct(calVal) && length(calVal) == 6
caseNum = 3;
else
error('Invalid Calibration')
end
obj.metaDynProp.(calName) = obj.addprop(calName);
switch(caseNum)
case 1
obj.(calName) = scalar;
case 2
case 3
end
set(obj.(calName),calVal);
end
end
end
The subclass definition is
classdef scalar < calibration
properties
value = [];
end
methods
function set(obj,value)
obj.value = value;
end
function value = get(obj)
value = obj.value;
end
end
end
I would like to have the functionality where a calibration can be added such as
x = calibration;
x.addCal('a',1);
Then when x.a is called, the output is 1. However, with the above implementation the output is a scalar object. Also, is there a way to prevent properties from being inherited?