| Using Simulink |
 |
Parameter Arguments in Embedded MATLAB Functions
Parameter arguments for Embedded MATLAB Function blocks do not take their value from a Simulink signal. Instead, they take their value from a parameter of a parent Simulink masked subsystem or a variable in the MATLAB base workspace. This allows you to pass a read-only constant in Simulink to the Embedded MATLAB Function block.
Use the following procedure to add a parameter argument to a function for an Embedded MATLAB Function block.
- In the Embedded MATLAB Editor, add an argument to the function header of the Embedded MATLAB Function block.
- The name of the argument must be identical to the name of the masked subsystem parameter or MATLAB variable that you want to pass to the Embedded MATLAB Function block. For information on declaring parameters for masked subsystems in Simulink, see The Mask Editor.
- Bring focus to the Embedded MATLAB Function block in Simulink.
- The new argument appears as a new input port in the Simulink diagram.
- In the Embedded MATLAB Editor, click the Explore tool
.
- The Model Explorer appears with the Embedded MATLAB Function block highlighted in the Model Hierarchy pane.
- In the Contents pane, click anywhere in the row for the new argument to highlight it.
- In the highlighted row, click the entry in the Scope column and select the value Parameter.
- You can also make this change in the Scope field of the Data properties dialog box on the far right.
- After you apply the scope change in the Model Explorer, examine the Embedded MATLAB Function block in Simulink.
- The new port no longer appears for the parameter argument.
| Note
Parameter arguments appear as arguments in the function header of the Embedded MATLAB Function block to maintain MATLAB consistency. This lets you test functions in an Embedded MATLAB Function block by copying and pasting them to MATLAB.
|
| Specifying Argument Sizes with Expressions | | Local Variables in Embedded MATLAB Functions |  |
© 1994-2005 The MathWorks, Inc.