Stateflow storage class - how to make it globalexternal storage class instead of auto?

4 views (last 30 days)
The variables in my stateflow model have the auto storage class, and on code generation they are generated as part of a structure (TEST_DWork) Is there a way to set stateflow variables to be of the ExportedGlobal storage class so they end up as global variables in code generation?

Answers (1)

Patel Mounika
Patel Mounika on 1 Apr 2019
Simulink implements global variables either as Data Store Memory blocks or Simulink.signal objects.
  • Verify that your models do not contain any Data Store Memory blocks.
  • In the MATLAB® base workspace, create a Simulink.Signal object with these attributes:
-Set Data type to an explicit data type. The data type cannot be Auto.
-Fully specify Dimensions. The signal dimensions cannot be –1 or Inherited.
-Fully specify Complexity. The complexity cannot be Auto.
-Set Storage class to ExportedGlobal.
  • In each chart that shares the data, bind a Stateflow data object to the Simulink data store.
Refer to below link for more understanding.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!