| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop |
| Contents | Index |
| Learn more about Real-Time Workshop |
The storage class property of a block state specifies how the Real-Time Workshop product declares and stores the state in a variable. Storage class options for block states are similar to those for signals. The available storage classes are
Auto
ExportedGlobal
ImportedExtern
ImportedExternPointer
Auto is the default storage class. Auto is the appropriate storage class for states that you do not need to interface to external code. States with Auto storage class are stored as members of the Dwork vector.
You can assign a symbolic name to states with Auto storage class. If you do not supply a name, the Real-Time Workshop product generates one, as described in Symbolic Names for Block States.
Block states with storage classes other than Auto are stored in unstructured global variables, independent of the Dwork vector. These storage classes are appropriate for states that you want to interface to external code. The following storage classes are available for states:
ExportedGlobal: The state is stored in a global variable. model.h exports the variable. States with ExportedGlobal storage class must have unique names.
ImportedExtern: model_private.h declares the state as an extern variable. Your code must supply the proper variable definition. States with ImportedExtern storage class must have unique names.
ImportedExternPointer: model_private.h declares the state as an extern pointer. Your code must supply the proper pointer variable definition. States with ImportedExternPointer storage class must have unique names.
The table in Summary of Signal Storage Class Options gives examples of variable declarations and the code generated for block states with each type of storage class.
Note Assign a symbolic name to states to specify a storage class other than auto. If you do not supply a name for auto states, the Real-Time Workshop product generates one, as described in Symbolic Names for Block States. |
The next section explains how to use the State Attributes tab of the block dialog box to assign storage classes to block states.
![]() | Block State Storage | Using the State Attributes Tab to Interface States to External Code | ![]() |

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 |