How do I tell which toolboxes my program uses?

Does anyone know of a quick way to test which toolboxes are used in a set of code. I have a large project (spread accross different functions), and I can't remember what toolboxes I had available when I wrote it.
I only have the basic install of MATLAB at my new company and need to figure out which toolboxes to buy. I can identify one because the code crashes when it hits a particular function, but can't easiy find out if there are others.
Perhaps there is a script out there to search the text and compare it against a list of functions in the different toolboxes?

1 comentario

Walter Roberson
Walter Roberson el 28 de En. de 2011
Does your code have any instances in which the name of the function was given as a string, such as a callback specified as a string, or instances of eval() or evalin() ?

Iniciar sesión para comentar.

 Respuesta aceptada

Andreas Goser
Andreas Goser el 28 de En. de 2011
There are a couple of things to try and consider. First, you can run code on a machine that has the necessary products (e.g. a trial version) and after running the code execute:
license('inuse')
and it will return what products you have used. With the exception of the point Walter mentione in his comment (in case the code uses EVAL), this is a save method.
Then there is the DEPFUN command that lists dependencies. I have seen users work with that, but you need to have a good understanding of the function names and to which product they belong. You may need to do research and it is error-prone.

1 comentario

Jiro Doke
Jiro Doke el 2 de Feb. de 2011
Wouldn't "licence inuse" catch calls to EVAL as well? EVAL operations would also check out the appropriate license, so it should be pretty robust.

Iniciar sesión para comentar.

Más respuestas (4)

Subin Kuttappan Stellal Mary
Subin Kuttappan Stellal Mary el 18 de Oct. de 2016

15 votos

matlab.codetools.requiredFilesAndProducts will list all the toolboxes used in the m script.

7 comentarios

Walter Roberson
Walter Roberson el 25 de Feb. de 2019
Olivia Hagedorn comments
Does not work in command window or in m file.
Walter Roberson
Walter Roberson el 25 de Feb. de 2019
Olivia Hagedorn: Which MATLAB release are you using? It works for me when I test in R2018b; it looks like it was defined first in R2014a
Debvrat Varshney
Debvrat Varshney el 6 de Mzo. de 2019
Editada: Debvrat Varshney el 6 de Mzo. de 2019
Nice. This works.
license('inuse') missed listing one toolbox somehow, compared to this
Walter Roberson
Walter Roberson el 6 de Mzo. de 2019
license('inuse') only catches licenses that have been invoked in this session. requiredFilesAndProducts analyses to find anything that might be invoked.
Evan
Evan el 12 de Mayo de 2023
This is actually not a solution to the original question since they only have base MATLAB install, so the tool will not telll which toolboxes are required
Set the random number generator to swb2712 and generate two random numbers. Multiply each of them by (-1)^randi(2) * 2.^randi([0 1024]) . complex() the two parts together. If I have constructed the numbers correctly, the complex number that results should potentially include every normalized complex number except for the ones with component 0 -- though I might be overlooking a boundary condition on the upper end. swb2712 generates every representable number on the open interval (0,1)
Okay, now have the code do
if x is a zero of the zeta function and ...
x is not a negative integer and ...
x is not a positive integer plus 1i/2
call a function in the Control System Toolbox
else
call a function in the Signal Processing Toolbox
end
Question for you:
Is it possible for MATLAB to tell you which toolboxes the function calls?
No, the answer is not "Control System Toolbox and Signal Processing Toolbox". It only calls one toolbox on any run. Is it possible to show that sometimes it will call one and sometimes it will call the other?
In order to show that sometimes it will call one toolbox and sometimes it will call the other toolbox, the examing program would have to come up with a proof or disproof of the Riemann Hypothesis . Which is something that no-one has been able to do in the last century.
Walter Roberson
Walter Roberson el 13 de Mayo de 2023
I suspect you could work up a variation on Turing's Halting Problem to show that there are deterministic programs where you cannot possibly tell in a finite amount of time which toolboxes the code invokes.

Iniciar sesión para comentar.

Andrew Newell
Andrew Newell el 28 de En. de 2011

3 votos

You could do a dependency report for each folder that your code is in (from the menu in the Current Folder window). The toolboxes will be apparent from the locations of the functions.
Oleg Komarov
Oleg Komarov el 28 de En. de 2011

2 votos

There is also a very useful submission by Us FDEP: function dependencies finder which detects calls to evalin also.

Calling

   fdep('functionName','-l') 

shows the dependencies in a GUI (here's just a preview):

Oleg

Preetham Manjunatha
Preetham Manjunatha el 19 de Nov. de 2025

0 votos

Here is the MATLAB code of a lighweight yet detailed toolboxes dependencies for each MATLAB script in the project folder. Produces report for the toolboxes used locally and globally in the project folder. In addition, one can ignore files. Please feel free to use it for your requirement.

Categorías

Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de En. de 2011

Respondida:

el 19 de Nov. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by