installed toolbox is not added to Matlab path

31 visualizaciones (últimos 30 días)
Romain Legrand
Romain Legrand el 25 de Mzo. de 2022
Comentada: Romain Legrand el 26 de Mzo. de 2022
I created a toolbox called Alexandria. This toolbox is now available on File Exchange (https://fr.mathworks.com/matlabcentral/fileexchange/108834-alexandria). To test that everything is fine, I downloaded and installed my own toolbox on my Matlab. The installation goes fine, but then I cannot use anything from my toolbox. For instance, the toolbox has a class for Bayesian linear regression called SimpleBayesianRegression. But when I use the command
lr = SimpleBayesianRegression(y,X)
I receive an error:
So it seems that in order to use the toolbox, I first need to add the toolbox root folder and its subfolders to the Matlab path. But aren't toolboxes precisely supposed to take care of all the path management at installation, so that the user doesn't have to do that himself? Or I am missing something, and it is normal that the path has to be added manually after the install?
Thanks a lot for any reply.
  1 comentario
Romain Legrand
Romain Legrand el 25 de Mzo. de 2022
As an additional insight: when I use the Set Path panel, the path to the toolbox is present on the Matlab search path, as can be seen at the bottom of the list:
So I really cannot make sense of the error message obtained when trying to use the toolbox.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 26 de Mzo. de 2022
But /root/MATLAB Add-Ons/Toolboxes/alexandria/alexandria is not on the path and neither is /root/MATLAB Add-Ons/Toolboxes/alexandria/alexandria/linearregression
I get the impression that the intent was that the functions would only be used from inside the graphics interface.
You can work around the problem by using
addpath(genpath('/root/MATLAB Add-Ons/Toolboxes/alexandria'))
  3 comentarios
Walter Roberson
Walter Roberson el 26 de Mzo. de 2022
My understanding is that each toolbox can have an installation script provided by the person who wrote the toolbox, and that script would be responsible for any path generation beyond the top level.
Romain Legrand
Romain Legrand el 26 de Mzo. de 2022
Thanks again for the useful comments. In the end, it seems the easiest way to solve my issue consists in setting the path manually from the Matlab panel. Use set path -> Add with subfolders, then select the root folder of the toolbox (that has normally been added to the list of existing paths at installation) -> Save (which keeps the path for future sessions).
Once this is done, all the subfolders of the toolbox have been added permanently to the path, and one can call any function/class without further ado.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by