Custom masks

DiffPlug uses a custom Simulink engine which optimizes for speed and modularity, at the cost of graphical fidelity. This allows us to quickly open Simulink files from anywhere - even inside of git repositories.

Although we are able to interpret and diff every single byte of data in your model, we are not always able to duplicate all of your custom mask code - especially when dealing with library and model reference blocks. To address this shortcoming, we have implemented a Custom masks function, which allows you to create simple rules for putting sensible masks on all of your in-house block libraries.

If you right-click any block in our Simulink viewer, you will see the Custom mask editor option.

Custom mask editor menu

This opens up the Mask editor dialog. You can write scripts which display text, block properties, and line drawings. We don't have a full M-language interpreter, so the masks have to be pretty simple. Here's an example which shows what we can do.

Example

% Use disp to print a string constant.
disp('SID is')
% Use disp with get_param(gcb, 'PROPNAME') to print a block property.
disp(get_param(gcb, 'SID'))
% Use plot to draw lines.
plot([0 1], [0 1]) # one bar of an X
plot([0 1], [1 0]) # the other bar

All of the masks you create are saved in your preferences, and can be shared with colleagues. See the config library section of the manual for full details on how to import, export, and share configs amongst team members.

Reference

The following is an exhaustive list of the commands we currently support.

disp('SID is')
disp(get_param(gcb, 'SID'))
% Can use `fprintf('%s', {arg})` or `text(x, y, {arg})` interchangeably with disp
fprintf('%s', 'SID is')
fprintf('%s', get_param(gcb, 'SID'))
text(0.5, 0.5, 'SID is')
text(0.5, 0.5, get_param(gcb, 'SID'))
% Use plot to draw lines.
plot([0 1], [0 1]) # one bar of an X
plot([0 1], [1 0]) # the other bar
% Images saved in UserData can be drawn
image(get_param(gcb,'userdata'))
% Images from file are not drawn, but we will show the file path
image('filename.png')
image(imread('filename.png'))