필터 지우기
필터 지우기

Interpreted custom function in Simulink

조회 수: 2 (최근 30일)
Vicente
Vicente 2015년 4월 20일
댓글: Vicente 2015년 4월 30일
Hello!
About the "MATLAB Function" block in Simulink, is there any way to avoid the compilation of the respective matlab file and let it be interpreted instead? Because the file is currently using some Matlab functions which prevent the block from compiling (es. try/catch, getfl, etc).
Thank you.

채택된 답변

Sebastian Castro
Sebastian Castro 2015년 4월 20일
편집: Sebastian Castro 2015년 4월 20일
Yes -- you can use coder.extrinsic to declare those unsupported functions as extrinsic. Check out the "plot" example in the documentation link.
EDIT: Actually, for Try/Catch this still may not work. You can use an Interpreted MATLAB Fcn block in that case.
- Sebastian
  댓글 수: 1
Vicente
Vicente 2015년 4월 30일
Hi! Thank you for your answer, much appreciated, and so sorry for the late response, but here it is!
Is it possible to omit compilation for an entire class method? Even if i used 'coder.extrinsic()' for all the non compilable functions being called in such method, the problem remains as it assigns some class properties dynamically, for example:
obj.(prop_name) = prop_val; %with prop_name being a variable (string).
Symulink displays the following error: "Non-constant expression or empty matrix. This expression must be constant because its value determines the size or class of some expression. In this context, the value of the string must be known."
It would be very useful if there was a way to do this which I'm asking, as the alternative for it would be way too burdensome.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by