필터 지우기
필터 지우기

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

조회 수: 8 (최근 30일)
Tobias Ladner
Tobias Ladner 2023년 9월 28일
댓글: Tobias Ladner 2023년 10월 13일
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