Reputation: 2732
Hi I saw this command that should allow to find toolboxes dependencies:
matlab.codetools.requiredFilesAndProducts
however such command will also list the installed toolboxes, which is not what I want. Is there a way to find out what are the toolboxes that are not installed but needed to execute a given script?
From the documtation
[fList, pList] = matlab.codetools.requiredFilesAndProducts(files)
also returns a list of the MathWorks® products possibly required to run the program files specified by files.
If you use the matlab.codetools.requiredFilesAndProducts function on MATLAB code that you received, plist only includes the required toolboxes that are installed on your system. In this case, plist can be incomplete.
So the command will list the "required" but that are "installed".
Upvotes: 4
Views: 383
Reputation: 8266
That appears to be the case, which is huge letdown because I'm in the situation where I'm trying to figure out for a new project I'm on what the full set of toolbox dependencies are prior to going and trying to install them. The alternative is to take the runtime failures piecewise until you discover all the dependencies.
My first missing discovered dependency is...
To use 'downsample', the following product must be licensed, installed, and enabled:
Signal Processing Toolbox
But when I run matlab.codetools.requiredFilesAndProducts
on my files the pList only displays a dependency on Matlab which is useless.
pList =
struct with fields:
Name: 'MATLAB'
Version: '9.3'
ProductNumber: 1
Certain: 1
The thing that's incredibly dissatisfying here is that the runtime is smart enough to detect what toolbox is required but the tooling is not smart enough to populate the pList with that same information.
I think the workaround is to have a colleague run this command on their local setup which is a known working environment and have them communicate the results of the pList over to you.
Upvotes: 0
Reputation: 35525
I can not test it because I have all toolboxes available, but something of the likes:
[files,plist]= matlab.codetools.requiredFilesAndProducts('myfile');
toolboxRequiredAndMissing(plist);
function toolboxRequiredAndMissing(plist)
v=ver;
for ii=2:length(plist)
found=false;
for jj=1:length(v)
found= strcmp(plist(ii).Name,v(jj).Name);
if found
break
end
end
if (~found)
disp(['Toolbox required and missing: ' plist(ii).Name]);
end
end
end
This does not consider versions.
Upvotes: 1