How to write an add-on installation script for my toolbox

19 次查看(过去 30 天)
I am working on a toolbox and want to provide an easy installation script for all required add-ons of my toolbox.
Is there a way to test if a specific add-on is already installed, and if not, launch the respective page in the add-on explorer / install it directly?
I know that there is matlab.addons.toolbox.installToolbox, but this would require the user to download the toolbox manually. I want to guide the user directly to the add-on explorer. I also know that you can use licence to check if a toolbox is already installed. However, I am missing a simple way to install toolboxes from the add-on explorer.
For example, I want the user to install the following add-ons and support packages:
  • Symbolic Math Toolbox
  • Deep Learning Toolbox
  • Deep Learning Toolbox Converter for ONNX Model Format
  4 个评论
Rik
Rik 2023-9-28
You could distribute the toolbox files along with your toolbox, but that is only feasible for internal use within an organization.
I don't know any way to do this, but I haven't looked into how to install toolboxes outside the context of installing Matlab.
Won't a guide with screenshots work?
Tobias Ladner
Tobias Ladner 2023-9-28
Well, I want to have an easy installation script, with as little user input as possible.
As you said, I could also just tell the user to install toolbox 1, 2, and 3.
However, an automatic installation script would be much more user-friendly.

请先登录,再进行评论。

回答(1 个)

ag
ag 2023-10-13
Hi Tobias,
I understand that you need to write a script, which will check if the required toolboxes are already installed, and if not, will install the same.
To do so, you can formulate a script using the below two commands:
  • To check the already installed toolboxes: matlab.addons.toolbox.installedToolboxes
  • To install the required toolboxes: matlab.addons.install
Below is a code sample for the same:
addons = ['Symbolic Math Toolbox', "Deep Learning Toolbox", "Deep Learning Toolbox Converter for ONNX Model Format"];
toolboxes = matlab.addons.toolbox.installedToolboxes
tb = struct2table(toolboxes);
for i = [1 : length(addons)]
flag = 1;
for j = [1 : size(tb.Name)]
if addons(i) == string(tb.Name(j))
flag = 0;
break;
end
end
if flag == 1
newAddon = matlab.addons.install(addons(i));
end
end
For more details, please refer to the following documentation links:
  • https://www.mathworks.com/help/matlab/ref/matlab.addons.toolbox.installedtoolboxes.html
  • https://www.mathworks.com/help/matlab/ref/matlab.addons.install.html
Hope this helps!
Best Regards,
Aryan Gupta
  1 个评论
Tobias Ladner
Tobias Ladner 2023-10-13
Thanks for coming back to me. Unfortunately, matlab.addons.install requires a toolbox file (*.mltbx) and you cannot just simply pass the name of the toolbox for me. Which Matlab version are you using?

请先登录,再进行评论。

类别

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

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by