% The private count variable, which is tunable by default
properties (Access = private)
pCount
end
methods (Access = protected)
% Increment the counter and return its value
% as an output
function c = stepImpl(obj)
obj.pCount = obj.pCount + 1;
c = obj.pCount;
end
% Reset the counter to either a random value or the initial
% value.
function resetImpl(obj)
if obj.UseRandomInitialValue
obj.pCount = rand();
else
obj.pCount = obj.InitialValue;
end
end
% This method controls visibility of the object's properties
function flag = isInactivePropertyImpl(obj,propertyName)
if strcmp(propertyName,'InitialValue')
flag = obj.UseRandomInitialValue;
else
flag = false;
end
end
end
end
See Also
isInactivePropertyImpl
See Also