I've created a test Stateflow chart (with an embedded PID controller in the chart). Within my model, I have defined a bus type SIGNALBUS to bus together some inputs to the PID controller chart. I also created the bus SIGNALBUS in the base workspace with matching inputs.
Within the chart, I reference a component/value within the bus with the syntax "busname.busfield". When I run the model, however, I get the error "Referencing a component from array of non-scalar values is not supported for code generation." See attachment for model. The attached file SIGNALBUS must be loaded to the bus editor before running the model.
Snapshot of chart and error:
If I look at the "sfbus_demo" example, though, it uses that same syntax that I've used. See below link for description of sfbus_demo:
http://www.mathworks.com/help/stateflow/ug/connect-structures-in-charts-to-external-bus-signals.html
Any thoughts on what I'm doing wrong? Thanks for the help.
Best Answer