%% Initialize Counter System object
% This example shows how to call setup on a System object. In most cases, you do not need to call setup directly because setup initialization happens the first time you run your System object.  Call setup before running only if you have concerns about the execution time of initialization.
%
% Create a System object Counter with a start value of 5. (See the full definition of Counter in the section below.)

count = Counter('StartValue',5)

% In the definition of the Counter object, setupImpl initializes the StartValue property with the specified number at which to start counting.   When you call setup, the System object calls setupImpl and also validates the input and property values. Because Counter has defined these internal validation methods, you must give setup an input value to validate.
% Initialize the StartValue for your count object by calling setup with a placeholder input value. After initialization, run the object.

setup(count,0)
count(2)

%
%% Full Definition of the Counter System object

type Counter.m

% Copyright 2019 The MathWorks, Inc.
%