How to find installation folder for matlab add-ons via command line?

조회 수: 66 (최근 30일)
Kevin Phung
Kevin Phung 2019년 5월 3일
댓글: Vinayaka Pattanashetti 2022년 3월 14일
Hi, I have a gui (made through a class method, in a class folder) that on start up checks whether or not the user has a specific toolbox installed.
I do this by:
matlab.addons.installedAddons
if a particular toolbox is not installed, it will install via a .mltbx within the class folder.
If the toolbox IS installed but is not up to date, it will install via the new .mltbx file.
it uninstalls and updates successfully, however, I am running into the issue of where the user will have to manually delete the old folder-- so I am trying to automate this.
My plan is to change the matlab directory to the path containing the old and new toolbox folder.
from here: https://www.mathworks.com/help/matlab/matlab_env/manage-your-add-ons.html I know that there is a default installation folder for addons, but this can also be customized in Home > Environment tab > preferences > Add ons.
Is there a way for me to navigate to wheverever this installation folder is? And so then I can just use:
rmdir
to remove the old one so that there wont be any naming issues.

답변 (1개)

Robert
Robert 2021년 1월 15일
It's a bit late, but anyone trying to do the same, try this:
mngr = com.mathworks.addons_toolbox.ToolboxManagerForAddOns();
installed = cell(mngr.getInstalled());
myTb = installed{find(cellfun(@(tb) strcmp(tb.getName(), 'MyToolboxName'), installed), 1)};
identifier = char(myTb.getInstallationIdentifier());
theFolder = extractBefore(identifier, '|');
Note that as of R2020b, the com.mathworks package is listed as will be removed in a future release. I'd be happy to learn about alternatives to this that do not use com.mathworks.
  댓글 수: 2
svanimisetti
svanimisetti 2021년 3월 8일
편집: svanimisetti 2021년 3월 8일
A more compact form can be obtained using arrayfun and getInstalledFolder function, eliminating the need to convert to a cell array and working with identifier.
tbxlist = com.mathworks.addons_toolbox.ToolboxManagerForAddOns().getInstalled();
idx = arrayfun(@(x)startsWith(x.getName(),'MyToolboxName'),tbxlist);
path = tbxlist(idx).getInstalledFolder();
Vinayaka Pattanashetti
Vinayaka Pattanashetti 2022년 3월 14일
MATLAB Add On folder not found in my windows laptop. But i see many add-ons installed. Plz help me, i need to copy some plugins out of this add-on folder into some other folder.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by