installed toolbox is not added to Matlab path

31 次查看(过去 30 天)
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 个评论
Romain Legrand
Romain Legrand 2022-3-25
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.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2022-3-26
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 个评论
Walter Roberson
Walter Roberson 2022-3-26
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 2022-3-26
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by