Main Content

matlab.system.display.Icon Class

Namespace: matlab.system.display

Specify custom image as icon for MATLAB System block

Description

Use the matlab.system.display.Icon class inside the getIconImpl method to specify a custom image to use as the icon for a MATLAB System (Simulink) block.

Class Attributes

Sealed
true

For information on class attributes, see Class Attributes.

Creation

Description

icon = matlab.system.display.Icon(img) specifies the icon for a MATLAB System block as the image img.

example

Input Arguments

expand all

Image for block icon, specified as a string or a character vector that defines the name of the file that contains the image. When the image file is not on the path, specify the full path to the file.

The image file must use a format supported for block masks. Images in .cur, .hdf4, .ioc, .pcx, .ras, .xwd and .svg cannot be used as block mask images.

Example: "image.png"

Examples

collapse all

Define an image to use as the icon for a MATLAB System block in the class definition file.

    methods(Access = protected)
        function icon = getIconImpl(~)
            icon = matlab.system.display.Icon("my_icon.png");
        end
    end

The specified image is now used as the icon for the MATLAB System block.

A MATLAB System block has an icon that uses an image of a circular gauge.

Version History

Introduced in R2017a