Creating a Model Reference

A model becomes a submodel when a Model block in some other model references it. Any model can function as a submodel, and such use does not preclude using it as a separate model also. To create a reference to a model (submodel) in another model (parent model):

  1. If the directory containing the submodel to be referenced is not on the MATLAB® path, add the directory to the MATLAB path.

  2. In the submodel:

  3. Create an instance of the Model block in the parent model by dragging a Model block instance from the Ports & Subsystems library to the parent model. The new block is initially unresolved (specifies no submodel) and has the following appearance:

  4. Open the new Model block's parameter dialog box by double-clicking the Model block. See Navigating a Model Block for more about accessing Model block parameters.

  5. Enter the name of the submodel in the Model name field. This name must contain fewer than 60 characters. (See Name Length Requirement.)

  6. Click OK or Apply.

If the referenced model contains any root-level inputs or outputs, Simulink® displays corresponding input and output ports on the Model block instance that you have created. Use these ports to connect the referenced model to other ports in the parent model. For information about connecting blocks in a parent model to a referenced model that has bus inputs or outputs, see Bus Usage Requirements.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS