Errors in executable file which is created from AppDesigner .
8 views (last 30 days)
Show older comments
Kaustubh hike
on 1 Sep 2021
Answered: Stefanie Schwarz
on 17 Apr 2024
Hi,
I have created one app which takes input as a path and if you press the button it loads specific .mat file from that path.
This is how app looks like
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/726544/image.png)
When I run .exe / standalone app , it gives following error in cmd.
'Error using matlabpath
Modifying the search path is not supported by MATLAB Compiler. Remove functions that modify the search path from your MATLAB code. To make files visible to your deployed application, add the parent folder to your MATLAB session.'
How to get ride of this issue ? or is it not possible in standalone app ?
this is how main part of code look like
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/726549/image.png)
1 Comment
Accepted Answer
Gopinath Karuppannan
on 1 Sep 2021
Edited: Gopinath Karuppannan
on 1 Sep 2021
Hi
You should not use the 'addpath' command (static) while creating the standalone executable file. Instead you can the get the directry information using uigetdir() as a dynamic. It avoids the error.
2 Comments
Gopinath Karuppannan
on 1 Sep 2021
uigetdir() --> it allows the user to select the working directory and return the path of the folder. So you can save the path in variable.[link:https://in.mathworks.com/help/matlab/ref/uigetdir.html]. Refer the following example:
pathname = uigetdir();
dir(fullfile(pathname,'*.mat'));
Hope it helps.
More Answers (2)
Matt J
on 1 Sep 2021
Remove this line from your code
addpath(direct)
It's not doing anything anyway.
0 Comments
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!