How can I access a MATLAB string variable within a Stateflow chart in MATLAB R2026a?

I'm working with Stateflow in MATLAB R2026a and have defined a MATLAB string variable outside of the chart (e.g., in the base workspace). I'd like to use this variable within the chart, but the Stateflow String Limitations documentation mentions that Stateflow parameter data cannot be of type string.
How can I access the MATLAB string variable within the chart?

 Accepted Answer

String parameter data within Stateflow is currently not supported in MATLAB R2026a.
As a workaround, you can input string data into your Stateflow chart by defining "Input Data" instead:
  1. Add an input data to your chart using the Stateflow Symbols Pane. This will create a new input port on the chart.
  2. Create a "String Constant" block in your Simulink model and specify the name of the MATLAB variable in the "String" block parameter.
  3. Connect the block output to the new input port on the chart.
For more information on adding data within Stateflow, refer to the Add Stateflow Data documentation.

More Answers (0)

Categories

Products

Release

R2026a

Community Treasure Hunt

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

Start Hunting!