Interpreted custom function in Simulink

2 views (last 30 days)
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.

Accepted Answer

Sebastian Castro
Sebastian Castro on 20 Apr 2015
Edited: Sebastian Castro on 20 Apr 2015
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 Comment
Vicente
Vicente on 30 Apr 2015
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!