Main Content

getIconImpl

Class: matlab.System

Name to display as block icon

Syntax

icon = getIconImpl(obj)

Description

icon = getIconImpl(obj) specifies the text or image to display on the block icon of the MATLAB System (Simulink) block. If you do not specify the getIconImpl method, the block displays the class name of the System object™ as the block icon. For example, if you specify pkg.MyObject in the MATLAB System block, the default icon is labeled MyObject

Run-Time Details

getIconImpl is called by the MATLAB System (Simulink) block during Simulink® model compilation.

Method Authoring Tips

You must set Access = protected for this method.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your getIconImpl method does not use the object, you can replace this input with ~.

Output Arguments

expand all

The text or image to display as the block icon. Each cell is displayed as a separate line.

Examples

expand all

Specify in your class definition file the name of the block icon as 'Enhanced Counter' using two lines.

methods (Access = protected)
   function icon = getIconImpl(~)
      icon = {'Enhanced','Counter'};
   end
end

Define an image in your class definition file.

    methods(Access = protected)
        function icon = getIconImpl(~)
            % Define icon for System block
            icon = matlab.system.display.Icon('my_icon.png');
        end
    end

The image now appears on the System block icon.

Version History

Introduced in R2017a