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.
UsegetInputNamesImpl
andgetOutputNamesImpl
to specify the names of the input port as “source data” and the output port as “count.”
If you do not specify thegetInputNamesImpl
andgetOutputNamesImpl
methods, the object uses thestepImpl
method input and output variable names for the input and output port names, respectively. If thestepImpl
method 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
Add Text to Block Icon
Add text to the block icon of a System object–based block implemented using aMATLAB Systemblock.
Subclass from custom icon class.
classdefMyCounter < matlab.System & matlab.system.mixin.CustomIcon
Use
getIconImpl
to specify the block icon asNew Counter
with a line break between the two words.methods (Access = protected)functionicon = getIconImpl(~) icon = {'New','Counter'};endend
Add Image to Block Icon
Define an image on the block icon of a System object–based block implemented using aMATLAB Systemblock.
Subclass from custom icon class.
classdefMyCounter < matlab.System & matlab.system.mixin.CustomIcon
Use
getIconImpl
method to call thematlab.system.display.Icon
class and specify the image.methods (Access = protected)functionicon = getIconImpl(~) icon = matlab.system.display.Icon('counter.png');endend