Standalone App installation folder

29 views (last 30 days)
Jan Prochazka
Jan Prochazka on 11 Feb 2021
Answered: Arturo Pinoon 23 Aug 2021
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.
文件= 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 Comments
Arturo Pino
Arturo Pino 2021年8月22日
I have the same question, were you able to resolve this?

Sign in to comment.

答案(2)

Rik
Rik on 23 Aug 2021

我个人使用此函数来存储持久文件,而不管OS和运行时版本如何:GetWritable Folder.


Arturo Pino
Arturo Pino on 23 Aug 2021
I was able to resolve this with this solution:
[〜,结果] =系统('path');
appDir = char(regexpi(result,'Path=(.*?);','tokens','once'));
Matlab的路径独立deskt补充道op 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.

s manbetx 845

Community Treasure Hunt

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

开始狩猎!