Saving files in a standalone .mlapp app

I am making a mlapp file in app designer, that I want to use as a standlone app. I have to save some .mat files in this app, and I noticed that when I try to run an app with double click on .mlapp file, I always get this error:
Error using save
Unable to write file BR_constraction_par.mat: permission denied
Then with pwd command I found out that app runs from C:\Windows\System32 and that is why I can't save my file. How can I cd to the folder where .mlapp file is located, if I don't know the path?
.

Respuestas (1)

Elliott Kitson
Elliott Kitson el 29 de Mzo. de 2026 a las 14:49
Hello, you can get the full path of the .mlapp file using:
appPath = mfilename('fullpath');
appDir = fileparts(appPath);
appPath will return the full path including the .mlapp file name, while fileparts will then return the folder location of the .mlapp file.
Hope this helps

Categorías

Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 13 de Jun. de 2021

Respondida:

el 29 de Mzo. de 2026 a las 14:49

Community Treasure Hunt

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

Start Hunting!

Translated by