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

12 ビュー (過去 30 日間)
Tobias
Tobias 2023 年 1 月 11 日
編集済み: Tobias 2023 年 1 月 13 日
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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by