Select target for model configuration set
switchTarget(
changes the selected system target file for the active configuration set.myConfigObj
,systemTargetFile
,[])
switchTarget(
sets the configuration parameters specified by
myConfigObj
,systemTargetFile
,targetOptions
)targetOptions
.
This example shows how to get the active configuration
set for model
, and change the system target file for the
configuration set.
% Get configuration set for model myConfigObj = getActiveConfigSet(model); % Switch system target file switchTarget(myConfigObj,'ert.tlc',[]);
This example shows how to get the active configuration
set for the current model (gcs
), set various
targetOptions
, then change the system target file
selection.
% Get configuration set for current model myConfigObj=getActiveConfigSet(gcs); % Specify target options targetOptions.TLCOptions = '-aVarName=1'; targetOptions.MakeCommand = 'make_rtw'; targetOptions.Description = 'my target'; targetOptions.TemplateMakefile = 'grt_default_tmf'; % Define a system target file targetSystemFile='grt.tlc'; % Switch system target file switchTarget(myConfigObj,targetSystemFile,targetOptions);
Use targetOptions
to verify values (optional).
% Verify values (optional)
targetOptions
TLCOptions: '-aVarName=1' MakeCommand: 'make_rtw' Description: 'my target' TemplateMakefile: 'grt_default_tmf'
This example shows how to get the active configuration
set for model
, then change the system target file to the
ERT Create Visual C/C++ Solution File for Embedded Coder.
model='rtwdemo_rtwintro'; open_system(model); % Get configuration set for model myConfigObj = getActiveConfigSet(model); % Specify target options for MSVC build targetOptions.MakeCommand = 'make_rtw'; targetOptions.Description = ... 'Create Visual C/C++ Solution File for Embedded Coder'; targetOptions.TemplateMakefile = 'RTW.MSVCBuild'; % Switch system target file switchTarget(myConfigObj,'ert.tlc',targetOptions);
Use options to select default ERT target file, instead of
set_param(model,'SystemTargetFile','ert.tlc')
.
% use switchTarget to select toolchain build of defaul ERT target model='rtwdemo_rtwintro'; open_system(model); % Get configuration set for model myConfigObj = getActiveConfigSet(model); % Specify target options for toolchain build approach targetOptions.MakeCommand = ''; targetOptions.Description = 'Embedded Coder'; targetOptions.TemplateMakefile = ''; % Switch system target file switchTarget(myConfigObj,'ert.tlc',targetOptions);
myConfigObj
— Configuration set objectobject
A configuration set object of ConfigSet
or
configuration reference object of Simulink.ConfigSetRef
. Call
getActiveConfigSet
to get the configuration
set object.
Example: myConfigObj = getActiveConfigSet(model);
systemTargetFile
— Name of system target fileSpecify the name of the system target file (such as
ert.tlc
for Embedded Coder® or grt.tlc
for Simulink®
Coder™) as the name appears in the System Target File
Browser.
Example: systemTargetFile = 'ert.tlc';
targetOptions
— Structure with field values that provide configuration parameter optionsStructure with fields that define a code generation target options.
You can choose to modify certain configuration parameters by filling
in values in a structure field. If you do not want to use options,
specify an empty structure ([]
).
targetOptions = [];
Specify the structure field values of the targetOptions
.
If you choose not to specify options, use an empty structure
([]
).
'TemplateMakefile'
— Character vector specifying file name of template makefileExample: targetOptions.TemplateMakefile =
'RTW.MSVCBuild';
'TLCOptions'
— Character vector specifying TLC argumentExample: targetOptions.TLCOptions =
'-aVarName=1';
'MakeCommand'
— Character vector specifying make command MATLAB® language fileExample: targetOptions.MakeCommand =
'make_rtw';
'Description'
— Character vector specifying description of the system target fileExample: targetOptions.Description = 'Create Visual C/C++
Solution File for Embedded Coder';