How do I determine the required toolboxes and licenses for my MATLAB code?
Show older comments
I would like to determine the license and toolbox dependencies for my MATLAB file.
Accepted Answer
More Answers (1)
Image Analyst
on 10 Oct 2025
Attached is a utility function I wrote.
This is what's in it:
% List required files and toolboxes. Displays them in the command window or console window (if deployed).
% Sample call
% fullFileName = [mfilename('fullpath'), '.m'];
% DisplayRequiredFunctions(fullFileName)
% It takes a long time to run so that's why I only do it in the development environment.
function DisplayRequiredFunctions(fullFileName)
try
if ~isdeployed
[~, baseFileNameNoExt, ext] = fileparts(fullFileName);
baseFileName = [baseFileNameNoExt, '.m'];
[requiredFileList, toolboxList] = matlab.codetools.requiredFilesAndProducts(fullFileName);
fprintf('Required m-files for %s:\n', baseFileName);
for k = 1 : length(requiredFileList)
fprintf(' %s\n', requiredFileList{k});
end
fprintf('Required MATLAB Toolboxes for %s:\n', baseFileName);
for k = 1 : length(toolboxList)
fprintf(' %s\n', toolboxList(k).Name);
end
end
catch ME
end
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!