- right-click on your block
- explore (it opens the Model Explorer directly at the right place)
- you should see the list of inputs and output of your MATLAB Function in the central part of the window
- For each variable:
- Click on it
- Set the variable size on the right part of the window
- Click on Apply button
- Once you have set all variables, you can close the Model Explorer and tada, it should work!
How can I define variable output size of Matlab function in Simulink?
55 次查看(过去 30 天)
显示 更早的评论
I cannot define variable output size of Matlab function in Simulink. I got to "Edit Data" window, choose my output, tick the "Variable size" box, then define size as "1 N" where N is an variable from different script, and it does not work. Matlab shows message: "Size computation for 'y' failed. Unknown var 'N' used in size definition."
0 个评论
回答(1 个)
Nicolas B.
2019-12-10
I also experienced that problem. When using the MATLAB Function block, I learned to always define the size of the inputs and outputs to avoid any trouble.
To do so:
4 个评论
Nicolas B.
2019-12-10
Than, you could refer to the answer given in this post:
Apparently, the answer worked.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Naming Conventions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!