How to write an add-on installation script for my toolbox
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Rik
am 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?
Antworten (1)
ag
am 13 Okt. 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
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!