MATLAB function block error in Simulink
16 ビュー (過去 30 日間)
古いコメントを表示
Rubeena Parveez
2020 年 9 月 24 日
編集済み: Abdolkarim Mohammadi
2020 年 9 月 24 日
Hi,
I am trying to run a function in Simulink model. I have the function working without any error if I call it in an m-script. However, if I add the same function in MATLAB function block, I have dimension errors.
Why don't I see these errors when I call it in m-script? Is there is a way to debug this?
Thanks
0 件のコメント
採用された回答
Abdolkarim Mohammadi
2020 年 9 月 24 日
編集済み: Abdolkarim Mohammadi
2020 年 9 月 24 日
Unlike m-file functions, MATLAB function block does not apply automatic array expansion. The simplest way to overcome is to define your m-file function as an extrinsic function in the MATLAB function block.
function v = fcn (u) % MATLAB function block
coder.extrinsic ('MATLAB function name'); % m-file function
6 件のコメント
Abdolkarim Mohammadi
2020 年 9 月 24 日
編集済み: Abdolkarim Mohammadi
2020 年 9 月 24 日
As far as I know, there is no way. As emphasized by documentation and the top contributor of this forum.
その他の回答 (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!