Filter löschen
Filter löschen

Stateflow matrix usage error.

3 Ansichten (letzte 30 Tage)
Chida Matada
Chida Matada am 4 Aug. 2015
Kommentiert: Chida Matada am 5 Aug. 2015
Hello, I tried looking through the solutions posted in the forum but could not find the one matching my issue.
In model explorer I have declared a data as of size [2 1]. And like it says in the examples that if you want to initialize to 0 then you don have to specify.
Now when I try accessing this data in my stateflow chart as data[1][1]=0; The following error pops up in the build.
Parse error: Unbalanced or unexpected parenthesis or bracket.
State 'Start' "[1][1]=2;"
I need to be able to access this array in a C file I am linking to.
Can some one tell me what I am doing wrong here. Thanks.

Akzeptierte Antwort

Sebastian Castro
Sebastian Castro am 4 Aug. 2015
A few things
  1. That exact error message comes up with your chart's action language is MATLAB, which is the new default since R2014a. If you want to use the C action language, you want to go to "File > Model Properties > Chart Properties" and change the language there.
  2. You defined "data" as a 2-by-1, but recall that in the C action language the first index is 0. Therefore, the second index cannot be a "1", which denotes a second column which does not exist.
- Sebastian

Weitere Antworten (0)

Kategorien

Mehr zu Complex Logic finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by