フィルターのクリア

Standalone App installation folder

14 ビュー (過去 30 日間)
Jan Prochazka
Jan Prochazka 2021 年 2 月 11 日
回答済み: Arturo Pino 2021 年 8 月 23 日
I amtrying to write miltilanguage app and i would like to keep track of the user prefences. I would like to use a mat file to store the last options user selected and I would like to keep it in the installation folder. How can I read it?
AppFolder=pwd;
returns the intended address only if the App is run directly from the installation folder. If run using desktop link it returns the desktop address.
files = matlab.apputil.getInstalledAppInfo;
[path,~,~] = fileparts(files(1).location)
throws either "Index exceeds the number of array elements (0)." when trying to access files(1).location when executed from Matlab command line or App Designer or "Cannot resolve matlab.apputil.getInstalledAppInfo" when executed from the standalone app.
How can I get the installation folder name to be able to store metadata neatly? Preferrably the way I can compile for Windows and linux without changing the code much.
  2 件のコメント
Jan Prochazka
Jan Prochazka 2021 年 2 月 11 日
編集済み: Jan Prochazka 2021 年 2 月 11 日
Addenum: Where are 'Files required for your application to run' installed and how can I access them?
Arturo Pino
Arturo Pino 2021 年 8 月 22 日
I have the same question, were you able to resolve this?

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

回答 (2 件)

Rik
Rik 2021 年 8 月 23 日

I personally use this function to store persistent files regardless of OS and runtime version: GetWritableFolder.


Arturo Pino
Arturo Pino 2021 年 8 月 23 日
I was able to resolve this with this solution:
[~, result] = system('path');
appDir = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
Matlab adds the path of the stand-alone desktop app to the front system path on every session, so this function checks for the first entry on PATH. This worked really well for me.

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by