How to add an image with overlaid text using System Object method getIconImpl(obj)?

Is it possible (or will it be in the future) to use the getIconImpl(obj) method in a system object classdef to place both an image and text on the simulink block icon?
It's possible to place an image:
icon = matlab.system.display.Icon('myicon.jpg');
It's possible to place text:
icon = 'My System';
However, I can't seem to place an image with overlaid text. Something similar to...
icon = {matlab.system.display.Icon('myicon.jpg'), ...
'My system'};
or something like...
icon = ['image(''logo1.png'');' ...
'disp(''My system'');'];
I know it is possible to use the mask editor to achieve the above functionality. However, I have been able to style the block mask and implement the controls all within the system object classdef file thus far. This is the only limiting action i have come across.

 採用された回答

dpb
dpb 2025 年 10 月 21 日
As you're aware, there's no indication of support the syntax you propose of more than one argument to matlab.system.display.Icon. In fact, the doc doesn't even imply the syntax
icon = 'My System';
wouldn't expect icon to be the name of a icon file, not a string to display; it indicates the argument type can be either a string or character vector variable, but doesn't imply there's a different behavior between passing the argument as the two different data types. That seems to be enhanced or unexpected behavior.
help matlab.system.display.Icon
matlab.system.display.Icon - Specify custom image as icon for MATLAB System block 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. Creation Syntax icon = matlab.system.display.Icon(img) Input Arguments img - Image for block icon string | character vector Examples web /MATLAB/help/matlab/ref/matlab.system.display.icon-class.html#bvom7l3 See also getIconImpl, matlab.system.mixin.CustomIcon Introduced in MATLAB in R2017a Documentation for matlab.system.display.Icon doc matlab.system.display.Icon
I would suggest if you have a solid justification/use case, this could be submitted to Mathworks as an official enhancement request at <Product Support Page>

1 件のコメント

Austin
Austin 2025 年 10 月 21 日
Thank you for the feedback! I will write up a use case and submit it to mathworks. Seems like a reasonable request.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgrammatic Model Editing についてさらに検索

製品

リリース

R2025b

質問済み:

2025 年 10 月 21 日

コメント済み:

2025 年 10 月 21 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by