switchTarget
Select target for model configuration set
Syntax
Description
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
.
Examples
Get ConfigSet, Default Options, and Switch Target
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',[]);
Get ConfigSet, Set Options, Switch Target
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'
Get ConfigSet, Set Options for Toolchain Build, and Switch Target
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='CounterModel'; openExample(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);
Input Arguments
myConfigObj
— Configuration set object
object
object
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 file
character vector
Specify 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 options
struct
Structure 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 ([]
).
Name-Value Arguments
Example: 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 makefile
character vector
Example: targetOptions.TemplateMakefile =
'myTMF';
TLCOptions
— Character vector specifying TLC argument
character vector
Example: targetOptions.TLCOptions =
'-aVarName=1';
MakeCommand
— Character vector specifying make command MATLAB® language file
character vector
Example: targetOptions.MakeCommand =
'make_rtw';
Description
— Character vector specifying description of the system target file
character vector
Example: targetOptions.Description = 'Create Visual C/C++
Solution File for Embedded Coder';
Version History
Introduced in R2009b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)