Main Content

setOverrideBuild

Override protected model build

Description

setOverrideBuild(callback, override) specifies whether a Simulink.ProtectedModel.Callback object can override the build process. This method is valid only for callbacks that execute in response to a 'Build' event for 'CODEGEN' functionality.

Examples

collapse all

  1. Create a callback object that uses a character vector of MATLAB® commands for the callback code. Define the callback for a 'Build' event for the 'CODEGEN' functionality.

    pmCallback = Simulink.ProtectedModel.Callback('Build',...
    'CODEGEN','disp(''Hello world!'')')
    
  2. Specify that the callback override the build process.

    setOverrideBuild(pmCallback, true);
    
  3. Protect the model sldemo_mdlref_counter and specify the callback that you created.

    openExample('sldemo_mdlref_counter');
    Simulink.ModelReference.protect('sldemo_mdlref_counter',...
    'Mode', 'CodeGeneration','Callbacks',{pmCallback})
    
  4. Build the model sldemo_mdlref_basic, which references the protected model sldemo_mdlref_counter. When the top model begins to build the protected model, the callback that you created overrides the build process.

    openExample('sldemo_mdlref_basic');
    slbuild('sldemo_mdlref_basic')

Input Arguments

collapse all

Protected model callback that you want to override the protected model build process, specified as a Simulink.ProtectedModel.Callback. The callback object must be defined for a 'Build' event for 'CODEGEN' functionality.

Option to override the protected model build process, specified as a Boolean value. This option applies to only a callback object defined for a 'Build' event for the 'CODEGEN' functionality.

Example: pmcallback.setOverrideBuild(true)

Version History

Introduced in R2016a