How to install required add-ons when using matlab.addons.install
28 次查看(过去 30 天)
显示 更早的评论
When installing an mltbx that has required addons by double clicking on it from the "Current Folder" panel the IDE will tell me about any additional required addons (toolboxes) that needs to be installed and install them as part of the interaction. If the toolbox is already present and has multiple versions available it will change the enabled version to the one that the mltbx requires during install.
I noticed that neither of these things happen if I install a toolbox using the matlab addon or toolbox install apis. I was wondering if there are other APIs that I can use to query an mltbx for it's "Required Add-ons" dependencies as part of an install from the command window (or other non GUI environment) to then pass to additional API install calls, or another way to achieve parity with the mltbx GUI installer functionality in a script environment.
I will note that calling open runs the dialog, but want to confirm this is intended (as mltbx is not on the doc page), and I need to test the behavior in a non interactive environment to see if it will automatically manage the install, or fail since there can be a confirmation dialog.
open("<name>.mltbx")
0 个评论
采纳的回答
Aishwarya Shukla
2023-3-30
Yes, you can query an mltbx for its "Required Add-ons" dependencies using MATLAB's matlab.addons.toolbox.toolboxVersion function. This function returns information about a toolbox version, including its required add-ons.
Here's an example of how you can use this function to get the required add-ons for a toolbox:
tbxInfo = matlab.addons.toolbox.toolboxVersion('<name>');
requiredAddons = tbxInfo.RequiredAddons;
This will return a cell array of required add-ons for the specified toolbox. You can then use this information to install the required add-ons using the matlab.addons.toolbox.installToolbox function:
for i = 1:length(requiredAddons)
addonName = requiredAddons{i};
matlab.addons.toolbox.installToolbox(addonName);
end
This will install each required add-on in turn. Note that you may need to provide additional arguments to the installToolbox function to specify installation options (such as installation directory or version) depending on your specific use case.
Regarding your question about calling open in a non-interactive environment, it's possible that this may not work as expected if there are confirmation dialogs or other interactive prompts involved in the installation process. In this case, you may need to use the matlab.addons.toolbox.installToolbox function or other installation APIs to ensure a fully automated installation process.
5 个评论
Aishwarya Shukla
2023-4-6
tbxInfo = matlab.addons.toolbox.toolboxVersion('<name>');
Only returns the version as a char and actually currently there is no documented function to get the dependency information.
更多回答(0 个)
另请参阅
类别
在 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!