How to find directory path for MATLAB add-ons from script

47 ビュー (過去 30 日間)
Cristiano Iacobelli
Cristiano Iacobelli 2021 年 5 月 20 日
コメント済み: Walter Roberson 2021 年 5 月 28 日
Hi, I have a script that will be run by multiple users on different computers. For it to run, it needs this directory path:
'C:\Users\name of user\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\'
It seems to be the same for every computer except for "name of user". I was wondering if there was a way to access this path dynamically without having every individual using it to manually change the name in the path.
Thanks.

採用された回答

Walter Roberson
Walter Roberson 2021 年 5 月 20 日
See https://www.mathworks.com/help/matlab/matlab_env/get-add-ons.html#buy5hl8-1 for documentation of the location of the folder.
As to where it is stored:
In prefdir, file matlab.mlsettings is an OpenXML document, which means it is a compressed heirarchy of XML related files.
Inside that, file fsroot/settingstree/matlab/addons/settings.json has groupName":"addons" with key InstallationFolder
I will poke around more to see if I can find a way of accessing it more nicely.
  3 件のコメント
Cristiano Iacobelli
Cristiano Iacobelli 2021 年 5 月 20 日
This is exactly what I was looking for. Thank you!
Walter Roberson
Walter Roberson 2021 年 5 月 28 日
Further note for future reference:
is the command line tool to install an add-on that you have the mltbx file for.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by