MATLAB Answers


"errors occurred during parsing of MATLAB function"

Asked by Zahid Khan on 12 Jun 2018
Latest activity Commented on by Ameer Hamza
on 15 Jun 2018
"errors occurred during parsing of MATLAB function" THis error i got while using matlab function (user defined function) with anonymous function.


@ammer Hamza , Sir, Actually you sent me file in 2018a version and my matlab is 2016a version, it was error while opring slx file. Now i downloaded 2018a version and installing that. After installation i will check it and reply you.
@Ameer Hamza Its working. I'm so much happy. and thank you very much bro. I spent considerable time but failed. and u did it.

Sign in to comment.

2 Answers

Answer by Ameer Hamza
on 12 Jun 2018
 Accepted Answer

You are getting these errors because MATLAB does not support code generation for all the function. The supported function list is here. Also, there are several restrictions for code generation for function handle. The easiest way to solve this problem is to move all of your code from Simulink function block to a MATLAB function file and save it in MATLAB path. Then define these functions as extrensic as shown on this link: Simulink will not try to generate code for the extrensic functions and simulation will run.


Yes, you are right. but i tried it on Matlab function it also give same error. I'm new in coding. Should i send you my code on your email address? I'm hope you can help me.. or may be u can send a blank email to me on '' then i will send it ..
It is better that you share your Simulink model file here. Other might contribute to the solution and the answer might be useful for some other people searching for the same problem. You can attach compress your model in a .zip file and upload it by using paperclip button.

Sign in to comment.

Answer by Zahid Khan on 12 Jun 2018

My errors and matlab function code are given in attached picture.


Refer to the attached file. You can see how to define the function as extrinsic.
Sir, great love and respect for you. i tried older code as i installed 2018a. it working.

Sign in to comment.