Using Simulink Previous page   Next Page

Adding an Embedded MATLAB Function Block to a Model

Start by creating an empty Simulink model and filling it with an Embedded MATLAB Function block, and other blocks necessary to complete the model.

  1. Create a new Simulink model and add an Embedded MATLAB Function block to it from the User-Defined Function library of the Simulink library.

  1. An Embedded MATLAB Function block has two names. The name in the middle of the block is the name of the function you build for the Embedded MATLAB Function block. Its name defaults to fcn. The name at the bottom of the block is the name of the block itself. Its name defaults to Embedded MATLAB Function.

    The default Embedded MATLAB Function block has an input port and an output port. The input port is associated with the input argument u, and the output port is associated with the output argument y.

  1. Add the following Source and Sink blocks to the model:
  1. The model should now have the following appearance:

  1. In the Simulink window, from the File menu, select Save As and save the model as call_stats_block1.

Previous page  Creating an Example Embedded MATLAB Function Programming the Embedded MATLAB Function Next page

© 1994-2005 The MathWorks, Inc.