Why does "matlab.co​detools.re​quiredFile​sAndProduc​ts" find a syntax error in MathWork code?

조회 수: 4 (최근 30일)
Hello all,
I tried to find the dependencies of a function/program I wrote, in order to clean up the folder of this program. The exectution of
[fList,pList] = matlab.codetools.requiredFilesAndProducts('myOwnFunction.m');
stops with an error I really do not understand:
Error using matlab.codetools.requiredFilesAndProducts (line 91)
MATLAB code 'C:\Program Files\MATLAB\R2021b\toolbox\coder\half\@half\half.p' contains the following syntax error(s):
Line 0 column 0 : Unable to open file 'C:\Program Files\MATLAB\R2021b\toolbox\coder\half\@half\half.p'. File is not a supported MATLAB code file.
How can I fix this issue?
  댓글 수: 3
Tobias
Tobias 2023년 1월 12일
Hi Benjamin,
unfortunately, I can't post the M file, as it is a function with many extra files, functions and subfunctions developed over the last years.
I made a string search in the whole code and it seems the code itself doesn't call the "half" function. So I tink it is the matlab coder who tries to call the function.
The function "half" exists in the folder, where matlab expects it.
Rik
Rik 2023년 1월 12일
Can you try to make a MWE? Make a copy of the project and start deleting code until the error disappears. That way you can determine which code is leading to this error.

댓글을 달려면 로그인하십시오.

채택된 답변

Tobias
Tobias 2023년 1월 13일
편집: Tobias 2023년 1월 13일
Yesterday, I used Rik's idea of a MWE, which is very easy in case of
matlab.codetools.requiredFilesAndProducts
. You can just comment out big parts of the code, as it is no need to led the code "run".
It took me the whole day, but I figured out, that just 2 simple typos deep in the code produced this error. They had nothing im common with the message of the error...
First problem was a written "NAN" instead of "NaN"
Second problem: one of the programmers defined the variable: "COS" (which is indeed not very clever to do... ), and used it in several scripts. Whereas matlab R2014a was fine with it, R2021b was somehow confused.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by