vector if statement in stateflow
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
更多回答(1 个)
Fangjun Jiang
2011-6-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))
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!