Main Content

Select a 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, Sink.m.

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

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

    classdef DigitalWrite < matlab.System ...
            & coder.ExternalDependency
            
        
        ...
        end
  4. Change the name of the constructor method to DigitalWrite.

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

    Note

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

  5. Save the changes to DigitalWrite.m.

In the next section, you will Specify the Initialization, Output, and Termination Behavior of the System object.

See Also

| |