How do you fix "not in scope" errors in simulink s-function?
16 views (last 30 days)
Show older comments
I'm running into an error with an S-function that I created from a Simulink Stateflow block using the Simulink Coder.
When I try to use the S-Function, I get the error: "Simulink.DataType object 'Braking_ControlModeType' is not in scope from 'HW_Sfun/Control/PLC/Braking_Control_fxdStp/Braking_Control_sfcn'"
I'm clueless as to what "not in scope" means in this context, and haven't found it addressed in the documentation. Can anyone point me to the right documentation?
Thanks!
PS I'm running this in R2017b. (Pictures and c code attached, in case it's helpful.)
0 Comments
Answers (1)
Mark McBroom
on 10 Mar 2018
Edited: Mark McBroom
on 10 Mar 2018
Is Braking_Control a signal/variable in your Stateflow diagram? I am guessing that this is the Active State Output of the state machine? For this feature, Simulink implicitly creates an enumerated data type to represent the state. A couple of possible workarounds:
1. If you don't need to output this state, then disable the feature in Stateflow and regenerate s-function.
2. If you do need to output the state, then you could try creating Simulink Enumerated data type. The name of the data type should be: Braking_ControlModeType and the enumerator values should be the names you have used for the states in your state machine.
0 Comments
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!