MATLAB function block error in Simulink
조회 수: 7 (최근 30일)
이전 댓글 표시
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!