This MATLAB class provides utility functions to manage and check dependencies required for executing MATLAB scripts. It allows users to:
- Check if required MATLAB toolboxes are installed.
- Identify dependencies of MATLAB files.
- Read and write dependency lists to a file.
Simply download and add the class to your MATLAB path:
addpath('path/to/DependencyManager');
To check if a MATLAB toolbox is installed:
isInstalled = DependencyManager.isDependencyInstalled("Simulink");
For multiple dependencies:
isInstalled = DependencyManager.isDependencyInstalled(["Aerospace Toolbox", "Curve Fitting Toolbox"]);
To analyze the dependencies required for executing a file or a set of files:
dependencies = DependencyManager.findDependencies("myScript.m");
For multiple files:
dependencies = DependencyManager.findDependencies(["script1.m", "script2.m"]);
Using wildcards to scan folders:
dependencies = DependencyManager.findDependencies("myFolder/*.m");
If you have a file listing dependencies (created with writeDependencies
), you can read it:
dependencies = DependencyManager.readDependencies("dependencies.txt");
To save the list of required dependencies for future reference:
DependencyManager.writeDependencies(dependencies, "dependencies.txt");
% Find dependencies of a script
requiredToolboxes = DependencyManager.findDependencies("example.m");
% Check if all required toolboxes are installed
isInstalled = DependencyManager.isDependencyInstalled(requiredToolboxes);
% Save dependencies to a file
DependencyManager.writeDependencies(requiredToolboxes, "dependencies.txt");
This project is licensed under the BSD 3-Clause License. See the LICENSE
file for details.
Modified from MatlabUtils by Carmine Varriale.