0

To clarify this at the beginning:

With image inside the mask of subsystem i do NOT mean an image drawn onto the block, but rather an image one can add to the mask:clarification

Is there a way to bind the image to the block? In case I want to distribute my model, I don't want to have to share every image used in it.

For an image drawn onto the block I found a solution here, that is storing the image inside the UserData of the block, but I can't find an option to change the properties of images used inside a mask.

Fugu_Fish
  • 131
  • 2
  • 10

2 Answers2

1

Quote out of my correspondence with the MathWorks Technical Support:

Unfortunately, it is currently not possible to specify a mask dialog image without providing a file path and a separate image file. This has been brought to the attention of the development team as a possible enhancement for a future release.

This refers to Matlab / Simulink 9 (2016a).

Fugu_Fish
  • 131
  • 2
  • 10
1

This might be a bit too late, but having the same problem I 'fixed' it by including the image and its alpha values in the 'UserData' parameter, checking if the image already exists in the current folder, and if not creating it from the userdata:

if ~exist('ARMicon.png','file')
    maskParams = Simulink.Mask.get(gcb);
    armim = maskParams.getDialogControl('armPic');
    ud = get_param(gcb,'UserData');
    imwrite(ud.ARM,'ARMicon.png','Alpha',ud.alpha);
    armim.FilePath = 'ARMicon.png';
end

See the result

Hope this helps.

Thomas Rollet
  • 1,573
  • 4
  • 19
  • 33
Max
  • 126
  • 4