Is it possible to have a vector input to a Simulink if-statement block?
4 ビュー (過去 30 日間)
古いコメントを表示
I am working on vectorising my model and I got stuck when I tried to vectorise the if-statement block. I wonder if it is possible to do it in Simulink. I know that it will work if I get each singal individually and apply them to multiple of if-statement blocks, but this is not what I want to do. Any suggestions will be greatly appreciated!
This is what I want to do and the error that I get:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151586/image.png)
0 件のコメント
採用された回答
Drew Davis
2015 年 6 月 26 日
You can only apply scalars to the if port of action subsystems. Consider your example where you test:
out1_of_if_block = u1 == [1 2] = [1 0]
What do you expect the If Action Subsystem2 to do when [1 0] is applied to the action port?
Perhaps inside of the 'If' block, you would want to do something more like this:
u1(1) == 1
3 件のコメント
Franco Ruiz
2019 年 8 月 2 日
@Ahmed Rashid @Tyene Zanella Any advice I am dealing with the same problem?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Event Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!