How to define and output signals in array form from stateflow chart ?

I want to output multiple values from Stateflow Chart in form of array.
Say V_fan[] is array of order 2
i is index i.e. V_fan[i]=1;
say V_fan[0]=0 and V_fan[1]=1;
how to define that inside stateflow chart such that V_fan[i] is output variable.
I tried to define {i=0} on default block condition and in state with
entry:V-fan{i}=0;
I am getting error as Varargout expected. Code generation supports cell subscripted assignment for varargout only.
State 'FanOff' (#80) "V_fan{i}"
please refer this link see the video for first few minutes and you will understand better.
Thanks Prasad

 Akzeptierte Antwort

Sebastian Castro
Sebastian Castro am 20 Mai 2015
Bearbeitet: Sebastian Castro am 20 Mai 2015
Given the syntax you are using, I'm assuming you are using the C action language. In that case, I see 2 syntax errors in that statement which is giving you problems.
  1. First off, you entered V-fan instead of V_fan as the variable name
  2. Secondly, C action language charts should index arrays with square brackets [ ] and not curly braces { }. This was the reason you got the error message.
I made a simple chart with your default transition action {i=0;} and the following state entry action and it worked fine.
entry: V_fan[i] = 0;
- Sebastian

Kategorien

Mehr zu Decision Logic finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by