How to write an add-on installation script for my toolbox
7 次查看(过去 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
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?
回答(1 个)
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
另请参阅
类别
在 Help Center 和 File 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!