disable simulink model error checking while modifying mask values programmatically in matlab

In order to disable simulink model error checking while modifying mask values programmatically in MATLAB, you can do the following:

main.m
% get the current error checking setting
errorCheckingFlag = get_param(bdroot, 'SimModelCheckerActiveSetting');

% temporarily disable error checking
set_param(bdroot, 'SimModelCheckerActiveSetting', 'off');

% modify mask values here

% re-enable error checking
set_param(bdroot, 'SimModelCheckerActiveSetting', errorCheckingFlag);
333 chars
11 lines

The first line gets the current error checking setting for the root level model. The second line disables the error checking while making updates to mask values through programmatic means. The third line modifies the necessary mask values as required. The fourth line re-enables the error checking with the previous error checking flag state.

By default, error checking is enabled in MATLAB/Simulink models. However, this can be disabled programmatically with the above code block to make life easier when making modifications.

gistlibby LogSnag