This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Select System Object Template

System objects are used to define the behavior of device driver blocks. Follow these steps to create your own System object™ by modifying the template System object.

  1. In the MATLAB® Editor, open the template System object class file, Source.m.

  2. Save a copy of the class file and rename it DigitalRead.m.

  3. Open DigitalRead.m and change the class name to DigitalRead.

    classdef DigitalRead < matlab.System ...
            & coder.ExternalDependency ...
            & matlab.system.mixin.Propagates ...
            & matlab.system.mixin.CustomIcon
        
        ...
        end
  4. Change the name of the constructor method to DigitalRead.

    methods
            % Constructor
            function obj = DigitalRead(varargin)
                % Support name-value pair arguments when constructing the object.
                setProperties(obj,nargin,varargin{:});
            end
        end
    

    Note

    A MATLAB class requires class name, constructor, and file to be identical.

  5. Save the changes to DigitalRead.m.

In the next section, you will Specify the Initialization, Output, and Termination behavior of your system object.

See Also

|