Real-Time Workshop Embedded Coder    

Assigning a Custom Storage Class to Data

You can assign a custom storage class to a Simulink data object either from the Simulink Data Explorer, or from the MATLAB command prompt.

Assigning a Custom Storage Classes via the Simulink Data Explorer

To create a custom parameter or signal object from the Simulink Data Explorer:

  1. Choose Data explorer from the Simulink Tools menu, or type slexplr at the MATLAB prompt. The Data explorer dialog box appears.
  2. In the Objects (left) pane, depress the right mouse button. A pop-up menu appears. Select New... from the menu, as shown in this figure.

  3. A New Object dialog box is displayed. Select Simulink.CustomParameter or Simulink.CustomSignal from the Class menu. Enter the name of the object in the Name field.
  1. In this figure, an object p of class Simulink.CustomParameter is created.

  1. Click OK. The object now appears in the Objects pane, and is selected. Its properties are shown in the Properties (right) pane.
  2. To view the properties of the object, open the RTWInfo field by clicking on the + button next to the field name. Similarly, open the RTWInfo.CustomAttributes field to show the class-specific attributes of the object (if any). This figure shows the initial properties of the Simulink.CustomParameter object p.

  3. Set the custom storage class of the object, by selecting a value for the object's RTWInfo.CustomStorageClass property from the CustomStorageClass menu. In this figure, the custom storage class of the object p is being changed from BitField to Define

    .
  4. This figure shows the object properties after the custom storage class property of p is set to Define. Notice that the BitFieldName attribute is no longer displayed, since that attribute applies only to objects whose custom storage class is BitField.

  5. Make sure that the RTWInfo.StorageClass property is set to Custom. If this property is not set to Custom, the custom storage properties are ignored.
  6. Click Close to dismiss the Simulink Data Explorer.

Assigning a Custom Storage Class via the MATLAB Command Line

You can create custom parameter or signal objects from the MATLAB command line. For example, the following commands create a custom parameter object p and a custom signal object s:

After creating the object, set the RTWInfo.CustomStorageClass and (optional) RTWInfo.CustomAttributes fields. For example, the following commands sets these fields for the custom parameter object p:

Finally, make sure that the RTWInfo.StorageClass property is set to its default value, Custom. If you inadvertently set this property to some other value, the custom storage properties are ignored.


  Other Custom Storage Classes Code Generation with Custom Storage Classes