Interpreted custom function in Simulink

5 次查看(过去 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