Main Content

isProtected

R2026b

Determine component reference model is protected

Description

flag = isProtected(compObj) determines whether or not the referenced model on the component is protected. Both published and protected models are saved with an SLXP extension. This function returns true only for protected models.

example

Examples

collapse all

Find whether or not the referenced model on the component is protected.

Create a new System Composer™ model and add a new component.

model = systemcomposer.createModel("archModel");
rootArch = get(model,"Architecture");
newComponent = addComponent(rootArch,"newComponent");

Create new Simulink® referenced model and save.

newRef = new_system("newReference","Model");
save_system(newRef);

Protect the Simulink model reference.

Simulink.ModelReference.protect(newRef);

Link the Simulink model to the component newComponent.

linkToModel(newComponent,"newReference.slxp");

Verify that the referenced model linked to the component is protected.

flag = isProtected(newComponent)
flag =

  logical

   1

Input Arguments

collapse all

Output Arguments

collapse all

Whether referenced model on component is protected, returned as 1 (true) or 0 (false).

Data Types: logical

More About

collapse all

Version History

Introduced in R2021b