Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop   

Using the State Attributes Tab to Interface States to External Code

In the State Attributes tab of a block parameter dialog box, you can interface a block's state to external code by assigning the state a storage class other than Auto (that is, ExportedGlobal, ImportedExtern, or ImportedExternPointer).

Set the storage class as follows:

  1. In your block diagram, double-click the desired block. This action opens the block dialog box with two or more tabs, which includes State Attributes.

  2. Click the State Attributes tab.

  3. Enter a name for the variable to be used to store block state in the State name field.

    The State name field turns yellow to indicate that you changed it.

  4. Click Apply to register the variable name.

    The first two fields beneath the State name, State name must resolve to Simulink signal object and Real-Time Workshop storage class, become enabled.

  5. If the state is to be stored in a Simulink signal object in the base or model workspace, select State name must resolve to Simulink signal object.

    If you choose this option, you cannot declare a storage class for the state in the block, and the fields below become disabled.

  6. Select the desired storage class (ExportedGlobal, ImportedExtern, or ImportedExternPointer) from the Real-Time Workshop storage class menu.

  7. Optional: For storage classes other than Auto, you can enter a storage type qualifier such as const or volatile in the Real-Time Workshop storage type qualifier field. The Real-Time Workshop product does not check this string for errors; what you enter is included in the variable declaration.

  8. Click OK or Apply and close the dialog box.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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