getBuildInfoForModel

Class: Simulink.ProtectedModel.CallbackInfo
Package: Simulink.ProtectedModel

Get build information object for specified model

Syntax

bldobj = getBuildInfoForModel(model)

Description

bldobj = getBuildInfoForModel(model) returns a handle to an RTW.BuildInfo object. This object specifies the build toolchain and arguments. 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 only for code generation callbacks in response to a 'Build' event.

Input Arguments

expand all

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. You can call this method only for code generation callbacks in response to a 'Build' event.

Output Arguments

expand all

Build toolchain and arguments, specified as a RTW.BuildInfo object. If you do not call the method for a code generation callback and 'Build' event, the return value is an empty array.

Examples

Get Build Information from a Code Generation Callback

On the MATLAB® path, create a callback script, pm_callback.m, containing:

cbinfobj = Simulink.ProtectedModel.getCallbackInfo(...
'sldemo_mdlref_counter','Build','CODEGEN');
bldinfo = cbinfobj.getBuildInfoForModel(cbinfobj.ModelName);
buildargs = getBuildArgs(bldinfo)

When you create a protected model with a simulation callback, use the script.

pmCallback = Simulink.ProtectedModel.Callback('Build',...
'CODEGEN', 'pm_callback.m')
Simulink.ModelReference.protect('sldemo_mdlref_counter',...
'Mode', 'CodeGeneration','Callbacks',{pmCallback})

Build the protected model. Before the start of the protected model build, the build arguments are displayed.

rtwbuild('sldemo_mdlref_basic')
Introduced in R2016a