Illegal use of a matrix or vector type where a scalar was expected. ERROR IN SIMULINK
39 ビュー (過去 30 日間)
古いコメントを表示
Hi, I am working on a chart block in SIMULINK where my imput is a variable over time. State Of Charge (SOC) of a battery.
When I try to run the model the following error pops up: Illegal use of a matrix or vector type where a scalar was expected.
Does anybody know how to fix this? Here I leave some images![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/503958/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/503958/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/503963/image.png)
0 件のコメント
回答 (1 件)
Shubham Khatri
2021 年 2 月 3 日
編集済み: Shubham Khatri
2021 年 2 月 3 日
Hello,
To my understanding it looks like you are trying to feed an array to stateflow input. The array when fed to a stateflow fiagram will result in an boolean array.
For example
SOC=[20 40 60 120];
ans= SOC >= 40
The output will be [0 1 1 1] rather 1 or 0. That is why you are getting this error. You need to make the stateflow input a scaler with respect to time steps.
Hope it helps
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!