Documentation

slbuild

Build standalone executable or model reference target for model; except where noted, this function requires a Simulink Coder license

Syntax

slbuild(model,buildSpec,varArgIn)

Description

example

slbuild(model,buildSpec,varArgIn) builds a standalone Simulink® Coder™ binary executable file from the model, using the current model configuration settings. If the model has not been loaded, slbuild loads it before initiating the build process. The buildSpec and varArgIn arguments are optional.

Do not use rtwbuild, rtwrebuild, or slbuild commands with parallel language features (Parallel Computing Toolbox) (for example, within a parfor or spmd loop). For information about parallel builds of referenced models, see Reduce Build Time for Referenced Models (Simulink Coder).

You cannot use slbuild to build subsystems.

Examples

collapse all

Generate C code for model rtwdemo_rtwintro.

slbuild('rtwdemo_rtwintro')
% same operation as ...
% slbuild('rtwdemo_rtwintro','StandaloneRTWTarget') 

For the GRT target, the coder generates the following code files and places them in folders rtwdemo_rtwintro_grt_rtw and slprj/grt/_sharedutils.

Model FilesShared FilesInterface FilesOther Files

rtwdemo_rtwintro.c

rtwdemo_rtwintro.h

rtwdemo_rtwintro_private.h

rtwdemo_rtwintrotypes.h

rtwtypes.h

multiword_types.h

builtin_typeid_types.h

rtmodel.h

none

If the following model configuration parameters settings apply, the coder generates additional results.

Parameter SettingResults
Code Generation > Generate code only pane is clearedExecutable image rtwdemo_rtwintro.exe
Code Generation > Report > Create code generation report is selectedReport appears, providing information and links to generated code files, subsystem and code interface reports, entry-point functions, inports, outports, interface parameters, and data stores

Generate code and build an executable image for rtwdemo_mdlreftop, which refers to model rtwdemo_mdlrefbot, regardless of model checksums and parameter settings.

slbuild('rtwdemo_mdlreftop','StandaloneRTWTarget', ...
    'ForceTopModelBuild',true)

Clean the model build area enough to trigger regeneration of the top model code at the next build.

slbuild('rtwdemo_rtwintro','CleanTopModel')

Input Arguments

collapse all

Model for which to build a standalone executable or model reference target, specified as a handle or a character vector representing the model name.

Example: gcs

The buildSpec directs the code generator to perform the selected build action for the model and the build process:

  • Honors the setting of the Rebuild parameter on the Model Referencing pane of the Configuration Parameters dialog box.

  • Requires a Simulink Coder license only if you build a model reference Simulink Coder target, not if you build only a model reference simulation target.

The buildSpec argument must be one of the following:

buildSpecBuild Action

'StandaloneRTWTarget'

Builds a standalone Simulink Coder binary executable file from the model, using the current model configuration settings. If the model has not been loaded, slbuild loads it before initiating the build process.

'ModelReferenceSimTarget'

Builds a model reference simulation target (does not require a Simulink Coder license)

'ModelReferenceRTWTarget'

Builds a model reference Simulink Coder target and the corresponding model reference simulation target

'ModelReferenceRTWTargetOnly'

Builds only a model reference Simulink Coder target

'CleanTopModel'

Cleans the model build area enough to trigger regeneration of the top model code at the next build

Example: 'ModelReferenceSimTarget'

slbuild(myModel,'StandaloneRTWTarget','ForceTopModelBuild',true)

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'UpdateThisModelReferenceTarget','Force'

collapse all

The 'UpdateThisModelReferenceTarget' option only applies when the buildSpec selection is 'ModelReferenceSimTarget', 'ModelReferenceRTWTarget', or 'ModelReferenceRTWTargetOnly'.

The 'UpdateThisModelReferenceTarget' value specifies a conditional rebuild option for the model reference target build when the Rebuild parameter on the Model Referencing pane of the Configuration Parameters dialog box is set to Never.

The 'UpdateThisModelReferenceTarget' value applies only to model, not to any models referenced by model.

The 'UpdateThisModelReferenceTarget' value must be one of the following:

UpdateThisModelReferenceTargetConditional Rebuild Action

'Force'

Unconditionally rebuilds the model. This option is equivalent to the Always rebuild option on the Model Referencing pane of the Configuration Parameters dialog box.

'IfOutOfDateOrStructuralChange'

Rebuilds the model if the build process detects any changes. This option is equivalent to the If any changes detected rebuild option on the Model Referencing pane of the Configuration Parameters dialog box.

'IfOutOfDate'

Rebuilds the model if the build process detects any changes in known dependencies of this model. This option is equivalent to the If any changes in known dependencies detected rebuild option on the Model Referencing pane of the Configuration Parameters dialog box.

Example: 'UpdateThisModelReferenceTarget','Force'

Use 'ForceTopModelBuild' value true to force the top model build.

Example: 'ForceTopModelBuild',true

Introduced before R2006a

Was this topic helpful?