Main Content

sltest.harness.setHarnessCreateDefaults

Customize default property values for test harness creation

Since R2021b

Description

sltest.harness.setHarnessCreateDefaults(name = value) sets and registers the specified harness creation default values for the specified name-value arguments. For a list of valid name-value arguments, see sltest.harness.create.

example

sltest.harness.setHarnessCreateDefaults('Name',token) sets the harness name using tokens. You cannot use tokens with the sltest.harness.create function or 'Name' = <value> syntax.

The available tokens, which you can use singly or in combination, are:

  • $modelName$ — Name of the model

  • $component$ — Name of the block or model that owns the harness

  • $ownerPath$ — Path of the harness owner. If the harness owner is a block diagram, $ownerPath$ is the same as $modelName$. If the harness owner is a block, $ownerPath$ is a block path in the owner model, where slash, /, separators are replaced by underscores. Spaces, carriage returns, and leading or trailing spaces are removed.

Enter the tokens exactly as shown. The token values are replaced automatically with the values of the associated model name, component, and owner path.

example

Examples

collapse all

sltest.harness.setHarnessCreateDefaults(SaveExternally = true)
sltest.harness.setHarnessCreateDefaults("Name",...
   $modelName$_$component$_Harness)

If the model is myModel and the harness owner is Controller, the resulting harness names are:

  • myModel_Controller_Harness

  • myModel_Controller_Harness1, etc.

If the model is myModel and the harness owner is myModel/Controller, the resulting harness names are:

  • myModel_Controller_Harness

  • myModel_Controller_Harness1, etc.

If the model is myModel and the harness owner is Aircraft Dynamics Model, the resulting harness names are:

  • myModel_AircraftDynamicsModel_Harness

  • myModel_AircraftDynamicsModel_Harness1, etc.

Alternatives

As an alternative to using sltest.harness.setHarnessCreateDefaults, you can use an sl_customization.m file to customize harness creation default values. See Customize Test Harness Creation Default Property Values.

If you created an sl_customization.m file, you can then use sltest.harness.setHarnessCreateDefaults to set additional default values or overwrite the values defined in that file. If you create an sl_customization.m file and register it after using sltest.harness.setHarnessCreateDefaults, the default values that you previously specified are overwritten with the default values in the file.

Version History

Introduced in R2021b