Add Description for Users

In this procedure, you modify the System object™ developed in Create a Digital Write Block to include a description in the block mask. The first group of comments written at the start of System object class are automatically imported into the block mask of the MATLAB System block.

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

  2. Replace the comments at the beginning of the class file with a description of the block.

    classdef DigitalWrite < matlab.System ...
            & coder.ExternalDependency ...
            & matlab.system.mixin.Propagates ...
            & matlab.system.mixin.CustomIcon
        %
        % Set the value of the selected GPIO pin on the harwdare board.
        % 
        %#codegen
        %#ok<*EMCA>
        
    ...
    end

    The first line of the comments becomes the message displayed inside the block mask.

    Note

    Do not remove the Compilation Directive %#codegen (Simulink).

  3. In your Simulink® model, double-click the DigitalWrite block to display the block mask. Confirm the description in the block mask matches the comments in the class file.

In the next section, you will Add Pin Number Property to your MATLAB System block dialog mask.

See Also

|