How do I determine the required toolboxes and licenses for my MATLAB code?
383 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2023 年 6 月 5 日
編集済み: MathWorks Support Team
2024 年 8 月 14 日
I would like to determine the license and toolbox dependencies for my MATLAB file.
採用された回答
MathWorks Support Team
2024 年 9 月 12 日
編集済み: MathWorks Support Team
2024 年 8 月 14 日
To fetch a list of toolbox dependencies for MATLAB files, consider the following methods:
Use the matlab.codetools.requiredfilesandproducts function to identify MathWorks products and other user-authored files a MATLAB file depends on. For example:
>> [fList,pList] = matlab.codetools.requiredFilesAndProducts('myFun1.m');
>> fList
'C:\work\myFun1.m' 'C:\work\myFun2.m'
>> {pList.Name}'
ans =
'MATLAB'
'Image Processing Toolbox'
In this case, 'myFun1.m' requires both MATLAB and the Image Processing Toolbox, as well as the user-written file 'myFun2.m'.
To analyze multiple MATLAB files, use the following syntax:
>> filesArray = {'test1.m', 'test2.m'};
>> [fList, pList] = matlab.codetools.requiredFilesAndProducts(filesArray);
NOTE: This method performs static analysis and does not account for runtime information. It may incorrectly include dependencies for overloaded functions with the same name but different parameters.
You can check the licenses that have been checked out by using the license function.Restart MATLAB and run the MATLAB file for which you wish to determine the toolboxes used. Then, enter the following command in the MATLAB prompt:
>> license('inuse')
NOTE: This approach depends on the execution of the code. If there are parts of the code are not executed, dependencies for these parts might be missing.
You can use the "Dependency Analyzer" app to find the files required by a MATLAB project, a folder, or a single file. The required toolboxes will be listed on the right side of the diagram. To see the toolboxes for a specific file, click on the file in the diagram and the list on the right will only show the dependencies for that file.
NOTE: Until R2022b, the Dependency Analyzer is only available for MATLAB Projects. Starting in R2023a, you can access Dependency Analyzer from the MATLAB apps gallery to perform a dependency analysis on files and folders that do not belong to a project.
Refer to the following link for the documentation of this function:
NOTE: This function is only available when Simulink is installed.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!