Main Content

getBuildInfoForModel

Build information object for specified model

Description

bldobj = getBuildInfoForModel(callbackInfo, model) returns the RTW.BuildInfo object that specifies the build toolchain and arguments for the model. The model name must be in the list of model names in the SubModels property of the Simulink.ProtectedModel.CallbackInfo object. You can call this method for only code generation callbacks in response to a 'Build' event.

Examples

collapse all

  1. On the MATLAB® path, create a callback script, pm_callback.m, that contains this code:

    cbinfobj = Simulink.ProtectedModel.getCallbackInfo(...
    'sldemo_mdlref_counter','Build','CODEGEN');
    bldinfo = cbinfobj.getBuildInfoForModel(cbinfobj.ModelName);
    buildargs = getBuildArgs(bldinfo)
  2. Create a callback object that uses the script.

    pmCallback = Simulink.ProtectedModel.Callback('Build',...
    'CODEGEN', 'pm_callback.m')
    Simulink.ModelReference.protect('sldemo_mdlref_counter',...
    'Mode', 'CodeGeneration','Callbacks',{pmCallback})
    
  3. Build the protected model. Before the start of the protected model build, the build arguments are displayed.

    slbuild('sldemo_mdlref_basic')

Input Arguments

collapse all

Callback information object, specified as a Simulink.ProtectedModel.CallbackInfo object. The callback object must be defined for a 'Build' event for the 'CODEGEN' functionality.

Model name, specified as a string or character vector. The model name must be in the list of model names in the SubModels property of the Simulink.ProtectedModel.CallbackInfo object.

Output Arguments

collapse all

Build toolchain and arguments, returned as a RTW.BuildInfo object.

Introduced in R2016a