Clear Filters
Clear Filters

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

8 views (last 30 days)
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 Comments
Rik
Rik on 28 Sep 2023
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 on 28 Sep 2023
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.

Sign in to comment.

Answers (1)

ag
ag on 13 Oct 2023
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 Comment
Tobias Ladner
Tobias Ladner on 13 Oct 2023
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?

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!