Main Content

Customize System Block Appearance

Specify Input and Output Names

Specify the names of the input and output ports of a System object™–based block implemented using aMATLAB Systemblock.

UsegetInputNamesImplandgetOutputNamesImplto specify the names of the input port as “source data” and the output port as “count.”

If you do not specify thegetInputNamesImplandgetOutputNamesImplmethods, the object uses thestepImplmethod input and output variable names for the input and output port names, respectively. If thestepImplmethod usesvararginandvarargoutinstead of variable names, the port names default to empty character vectors.

methods (Access = protected)functioninputName = getInputNamesImpl(~) inputName ='source data';endfunctionoutputName = getOutputNamesImpl(~) outputName ='count';endend

Complete Class Definition with Named Inputs and Outputs

Add Text to Block Icon

Add text to the block icon of a System object–based block implemented using aMATLAB Systemblock.

  1. Subclass from custom icon class.

    classdefMyCounter < matlab.System & matlab.system.mixin.CustomIcon

  2. UsegetIconImplto specify the block icon asNew Counterwith a line break between the two words.

    methods (Access = protected)functionicon = getIconImpl(~) icon = {'New','Counter'};endend

    Complete Class Definition File with Defined Icon

Add Image to Block Icon

Define an image on the block icon of a System object–based block implemented using aMATLAB Systemblock.

  1. Subclass from custom icon class.

    classdefMyCounter < matlab.System & matlab.system.mixin.CustomIcon

  2. UsegetIconImplmethod to call thematlab.system.display.Iconclass and specify the image.

    methods (Access = protected)functionicon = getIconImpl(~) icon = matlab.system.display.Icon('counter.png');endend

    Complete Class Definition File with Icon Image

See Also

Functions

Classes

Related Topics