Simulink running despite error message
1 回表示 (過去 30 日間)
古いコメントを表示
So, I have the following issue, that confuses me. I have simulink model to compare different controller (in Variant Subsystems). I use mainly MATLAB Function Blocks to implement those controllers. For one controller, however, simulink throws me an error message:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1754474/image.png)
This is the only error message and it doesn't make sense to me. But the simulation completes normally, and all the values seem correct. I could also set breakpoints and check on the matrix dimensions:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1754479/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1754484/image.png)
I am wondering if anybody had same issue and what causes it? I could just ignore it, but this does not seem right for me. I would rather fix this.
2 件のコメント
Walter Roberson
2024 年 8 月 19 日
As a matter of form, I would avoid using
r_n = N_x(1)\r;
The \ is seldom used with scalar left operand, so most people will not understand the operation you are doing there, which is equivalent to
r_n = r ./ N_x(1);
採用された回答
halleyhit
2024 年 8 月 19 日
It seems Simulink can not determine the size of variables in MATLAB Function block. Please try to use "edit data" on top left, and set your intput and output variable size other than -1.
3 件のコメント
halleyhit
2024 年 8 月 22 日
With setting size to -1, sometimes MATLAB is able to detemine the size, but sometimes it can not. I have no idea on when the detemination works, but best practice is to set the value strongly.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!