Changing Interpreted MATLAB Fcn into MATLAB Function

5 views (last 30 days)
Hello,
in order to speed up my simulink model I am trying to switch the Interpreted MATLAB Fcn into a MATLAB FUNCTION. It is nothing more than just copying the codes that are written in Interpreted MATLAB Fcn direct into MATLAB FUNCTION.
The Simulink model stays the same except the Fcn blocks that are mentioned above.
When I do so, I get the following error :
Errors occurred during parsing of MATLAB function 'MATLAB Function'(#21)
When I simulate with the Interpreted MATLAB Fcn, script that is linked to the MATLAB Fcn block are able to set the breakpoints.
But when I switch over to MATLAB Function block, the simulation does not stop at the breakpoints in MATLAB FUNCTION block and I get the above mentioned error instead.
It would be very appreciating to get some advices..
Thank you very much.

Answers (1)

Kaustubha Govind
Kaustubha Govind on 11 Apr 2014
MATLAB Function blocks generate C code from your MATLAB code to enable faster execution. It looks like the errors are occurring during the code-generation process, which is before the code starts execution. In other words, the error occurs before it can stop at a breakpoint. There should be an additional error other than just Errors occurred during parsing of MATLAB function 'MATLAB Function'(#21)" - those should give you a clue about what you need to fix to enable code-generation.

Categories

Find more on Event Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!