Why do I receive an error if I have variables with the same name in my Stateflow chart and in my custom external code?

7 views (last 30 days)
I have a Stateflow variable defined with the same name as an array in my custom code. Each has been declared with a different array size. This produces an error.
State = SS[3].State[4];}
^
Array dimensions mismatch for data State (#698).

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This is an expected behavior of Stateflow, because the parser is not able to handle identical variable names with different sizes in Stateflow and custom code.
Currently, to work around this problem, make sure the Stateflow names and custom code names do not clash.

More Answers (0)

Categories

Find more on Complex Logic 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!