Main Content


Get current protected model target



currentTarget = Simulink.ProtectedModel.getCurrentTarget(protectedModel) returns the target identifier for the target that is currently configured for the protected model. At the start of a MATLAB® session, the default current target is the last target added to the protected model. Otherwise, the current target is the last target that you used. You can change the current target using the Simulink.ProtectedModel.setCurrentTarget function.

When building the model, the software changes the target to match the parent if the currently selected target does not match the target of the parent model.


collapse all

Add a target to a protected model, and then get the currently configured target for the protected model.

Load the model and save a local copy.


Add a required password for modifying a protected model. If you do not add a password, you are prompted to set a password when you create a modifiable, protected model.


Create a modifiable, protected model with support for code generation.

'CodeGeneration', 'Modifiable',true, 'Report',true);

Configure the unprotected model to support a new target.

 set_param('mdlref_counter', 'SystemTargetFile', 'ert.tlc'); 

Add support to the protected model for the new target. You are prompted for the modification password.


Verify that support for the new target has been added to the protected model.

 st = Simulink.ProtectedModel.getSupportedTargets('mdlref_counter')

Get the currently configured target for the protected model.

 ct = Simulink.ProtectedModel.getCurrentTarget('mdlref_counter')

Input Arguments

collapse all

Protected model name, specified as a string or character vector.

Output Arguments

collapse all

Current target for protected model, specified as a character vector.

Version History

Introduced in R2015a