How to get the user's installation path in my app designer?
57 ビュー (過去 30 日間)
古いコメントを表示
When I use app designer, I want to create some folder in the installation path when someone is using my app. How can I get the installation path where my app is installed?
For example, someone installs my app in 'C:\Program Files\myapp', I want to create a folder in this path to save some compute results. How can I get this installation path when I am coding by app designer?
3 件のコメント
回答 (1 件)
Rik
2021 年 6 月 2 日
If you want more control over where your persistent files are stored, I would suggest the GetWritableFolder.
This will generate a path that is persistent across versions of Matlab and across calls. This is what I currently use if I want to persistently store configurations.
f=GetWritableFolder('ForceStatus',1);
6 件のコメント
Rik
2021 年 6 月 5 日
It does have to do with privileges. If the user installs your app as admin (and puts it in a location where you need admin privileges to write), and then runs your app as a normal user, you're stuck. If you use my function you are guaranteed the same path every time, and you should have write access as any user.
I don't know if there is a function that will return the installation folder (maybe matlabroot gets modified?), but you shouldn't be using that anyway. The %APPDATA% folder shortcut exists for a reason.
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!