methods
function obj = MySaveLoader(varargin)
[email protected]();
setProperties(obj,nargin,varargin{:});
end
function set.dependentprop(obj, value)
obj.pdependentprop = min(value, 5);
end
function value = get.dependentprop(obj)
value = obj.pdependentprop;
end
end
methods (Access = protected)
function setupImpl(obj)
obj.state = 42;
obj.child = Counter;
end
function out = stepImpl(obj,in)
obj.state = in + obj.state + obj.protectedprop + ...
obj.pdependentprop;
out = obj.child(obj.state);
end
end
% Serialization
methods (Access = protected)
function s = saveObjectImpl(obj)
% Call the base class method
s = [email protected](obj);
% Save the child System objects
s.child = matlab.System.saveObject(obj.child);
% Save the protected & private properties
s.protectedprop = obj.protectedprop;
s.pdependentprop = obj.pdependentprop;
% Save the state only if object called and not released
if isLocked(obj)
s.state = obj.state;
34 System object Usage and Authoring