Main Content

Simulink.ProtectedModel.open

Open protected model

Description

Simulink.ProtectedModel.open(model) opens a protected model. If you do not specify how to view the protected model, the software first tries to open the Web view. If the Web view is not enabled for the protected model, the software then tries to open the report. If you did not create a report, the software reports an error.

example

Simulink.ProtectedModel.open(model,type) opens a protected model using the specified viewing method. If you specify ‘webview’, the software opens the Web view for the protected model. If you specify ‘report’, the software opens the protected model report. If the method that you specify is not enabled, the software reports an error. The protected model is not opened.

example

Examples

collapse all

Open a protected model without a specified method.

Load the model and save a local copy.

openExample('sldemo_mdlref_counter');
save_system('sldemo_mdlref_counter','mdlref_counter.slx');

Create a protected model enabling support for code generation and reporting.

Simulink.ModelReference.protect('mdlref_counter','Mode',...
'CodeGeneration', 'Report',true);

Open the protected model without specifying how to view it.

Simulink.ProtectedModel.open('mdlref_counter')

The protected model does not have Web view enabled, so the protected model report is opened.

Open a protected model, specifying the Web view.

Load the model and save a local copy.

openExample('sldemo_mdlref_counter');
save_system('sldemo_mdlref_counter','mdlref_counter.slx');

Create a protected model with support for code generation, Web view, and reporting.

Simulink.ModelReference.protect('mdlref_counter','Mode',...
'CodeGeneration', 'Webview',true,'Report',true);

Open the protected model and specify that you want to see the Web view.

Simulink.ProtectedModel.open('mdlref_counter','webview')

The protected model Web view is opened.

Input Arguments

collapse all

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

Method for viewing the protected model. If you specify ‘webview’, the software opens the Web view for the protected model. If you specify ‘report’, the software opens the protected model report.

Version History

Introduced in R2015a