%% Prepare the Parent Model

% Copyright 2018 The MathWorks, Inc.

%% 
% This example shows how you can protect a model that is referenced by 
% a Model block in the parent model. Open the parent model |hdlcoder_protected_model_parent_harness|.
open_system('hdlcoder_protected_model_parent_harness')
set_param('hdlcoder_protected_model_parent_harness','SimulationCommand','Update')
%%
% Navigate to the Model block in your parent model. If you double-click the 
% |DUT| Subsystem, and then open the |mynested| Subsystem, you see a Model block that 
% references the model |hdlcoder_referenced_model_gain|.
open_system('hdlcoder_protected_model_parent_harness/DUT/mynested')
%%
% Open the Model block and make sure that a _modelname_ with the extension
% |.slx| is specified in the *Model name* field. When both the referenced
% model and the protected model exist in the same folder, the parent model 
% references the protected model unless the extension is specified.
%% 
% In this case, the Model block is referencing the model |hdlcoder_referenced_model_gain.slx|,
% the model that you want to protect. Double-click the |Model| block 
% or open the model |hdlcoder_referenced_model_gain| in a separate window.
open_system('hdlcoder_referenced_model_gain')
set_param('hdlcoder_referenced_model_gain','SimulationCommand','Update')