"errors occurred during parsing of MATLAB function"

"errors occurred during parsing of MATLAB function" THis error i got while using matlab function (user defined function) with anonymous function.

6 件のコメント

KSSV
KSSV 2018 年 6 月 12 日
Show us the function...I guess you missed some grammatical syn taxes.
Zahid Khan
Zahid Khan 2018 年 6 月 14 日
Its attached here attachment. In this code, RL1, QL1 , RL2 and QL2 are considered as input variables and v1r,v1q,v2r as output variables. This code workes on m.file. but i want to run it on matlab function (user defined function in sumulink).
Pleae help me out. hankx in advance.
Ameer Hamza
Ameer Hamza 2018 年 6 月 14 日
@Zahid, have you checked the file which I have attached in the comment below???
Zahid Khan
Zahid Khan 2018 年 6 月 14 日
@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.
Zahid Khan
Zahid Khan 2018 年 6 月 14 日
@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.
Ameer Hamza
Ameer Hamza 2018 年 6 月 15 日
You are welcome.

サインインしてコメントする。

 採用された回答

Ameer Hamza
Ameer Hamza 2018 年 6 月 12 日

1 投票

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: https://www.mathworks.com/help/simulink/ug/calling-matlab-functions.html. Simulink will not try to generate code for the extrensic functions and simulation will run.

4 件のコメント

Zahid Khan
Zahid Khan 2018 年 6 月 14 日
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 'engineerzahid@yahoo.com' then i will send it ..
Ameer Hamza
Ameer Hamza 2018 年 6 月 14 日
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.
ERNESTO BENJAMIN PAZ YAÑEZ
ERNESTO BENJAMIN PAZ YAÑEZ 2021 年 4 月 6 日
But supouse with need to generate the code any way. How could we know wich function is causing problems?. Do we need to go one by one checking on the list?, or there is a smarter way?
Steven Lord
Steven Lord 2021 年 4 月 6 日
Take a look at this section in the documentation for MATLAB Coder.

サインインしてコメントする。

その他の回答 (1 件)

Zahid Khan
Zahid Khan 2018 年 6 月 12 日

0 投票

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

6 件のコメント

Ameer Hamza
Ameer Hamza 2018 年 6 月 12 日
@Zahid, it is better to add these images to your question instead of adding a new answer. You can delete this answer after adding these images to your question. Also, your error message in the image differs from the title. My answer addresses the errors shown in the image.
Zahid Khan
Zahid Khan 2018 年 6 月 14 日
Kindly find attachment. In this code, RL1, QL1 , RL2 and QL2 are considered as input variables and v1r,v1q,v2r as output variables. This code workes on m.file. but i want to run it on matlab function (user defined function in sumulink).
It will be great honor if u help me to solve this problem as it is part of my project. Thankx in advance.
Ameer Hamza
Ameer Hamza 2018 年 6 月 14 日
Refer to the attached file. You can see how to define the function as extrinsic.
Ameer Hamza
Ameer Hamza 2018 年 6 月 14 日
Try this file for R2016a.
Zahid Khan
Zahid Khan 2018 年 6 月 14 日
Sir, great love and respect for you. i tried older code as i installed 2018a. it working.
Saba
Saba 2023 年 3 月 3 日
Hi there, i also have the same problem, but I do not know how to figure it out in order to correct it.
Could you please help me out?
I attached three screenshots in the pdf file.

サインインしてコメントする。

質問済み:

2018 年 6 月 12 日

コメント済み:

2023 年 3 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by