vector if statement in stateflow

Hi
i just wanna ask,I wan't to make an if statement from vector data, let say vector(1x20) in stateflow, for example if the value vector(1 to 10) > 100 then y=2000 and vector(10 to 20) > 100 then y=4000 ,, so the input is vector from simulink,, can i??? how was the script on stateflow?? or any suggestion???
thanks

 採用された回答

Luhur
Luhur 2011 年 6 月 2 日

0 投票

i have found the problem, correct me if it were wrong, its enough to wrote it like this:
condition: [V[0]>100 && V[9]>100] action: {y=2000;}

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2011 年 6 月 1 日

1 投票

You can use Stateflow to construct a simple flow chart to do that. I assume you know Stateflow "transition", "condition", "action", etc.
condition: [V[0]>100 && V[1]>100 && ... && V[9]>100]
action: {y=2000;}
You see this is rather tedious. I suggest you not to do it using Stateflow. You can do it using the Matlab function block combined with a switch block. Use the Matlab function block to check the condition.
double(all(u(1:10)>100))

2 件のコメント

Luhur
Luhur 2011 年 6 月 2 日
why my stateflow always said syntax error and its pointed (^)to the end of syntax?? ex: [V[0]>100 && V[1]>100 && ... && V[9]>100]{y=2000;}
_____________________________^
if we talking about tedious, which one more faster acording to matlab run the block??? asume we have a lot of statement like this
Luhur
Luhur 2011 年 6 月 3 日
anyway,, thanks Fangjun Jiang... :)

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDecision Logic についてさらに検索

質問済み:

2011 年 6 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by