I got help from MATLAB technical support. I was defining the variable TestInput to be of size 4. The size is for the structure, and should have been 1. With a size of 4, MATLAB was expecting an array of structures.
How do I reference a value from a bus within a Stateflow chart? (coder error in Stateflow)
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!