How can I define variable output size of Matlab function in Simulink?
이전 댓글 표시
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."
답변 (1개)
Nicolas B.
2019년 12월 10일
0 개 추천
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:
- 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!
댓글 수: 4
sdsd sdsd
2019년 12월 10일
Nicolas B.
2019년 12월 10일
I don't know how the "model parser" of Simulink works, but with MATLAB Function block, I would recommend to always define the size (e.g. [2x1]) and not use "Variable size". You avoid a lot of potential problems while running your models.
sdsd sdsd
2019년 12월 10일
Nicolas B.
2019년 12월 10일
Than, you could refer to the answer given in this post:
Apparently, the answer worked.
카테고리
도움말 센터 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!