Matlab ignores the initial working folder setting

8 visualizaciones (últimos 30 días)
Maurice Volaski
Maurice Volaski el 2 de Jun. de 2023
Editada: Image Analyst el 3 de Jun. de 2023
New installation of MatLab 2023a on a Windows 10 computer with a previous release installed. It opens to the initial working folder of the binary location of MatLab. We changed it to a Matlab folder inside Documents. The General Preferences remembers this choice and even changes it initially, but restart Matlab and it's back to the binary locaion of Matlab, but the General Preferences setting is correct, what we set it to.
  1 comentario
Catalytic
Catalytic el 2 de Jun. de 2023
Editada: Catalytic el 2 de Jun. de 2023
And your question is why deos this happen?

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 2 de Jun. de 2023
Editada: Image Analyst el 3 de Jun. de 2023
Create a startup.m file and put it in a folder that is at the top of your path. You can then have it cd to whatever folder location you want upon startup. Like
In startup.m
cd('c:\Users\Maurice\Document\MATLAB\my projects')
Also check out userpath
help userpath
USERPATH User environment path. USERPATH returns a user-specific folder that MATLAB adds to the search path at startup, specified as a character vector. The default userpath is platform-specific: Windows: user's "Documents" folder appended with "MATLAB" Mac: user's "Documents" folder ($home/Documents) appended with "MATLAB" Linux: user's $home folder appended by "Documents" and "MATLAB" (if there is no $home/Documents directory, userpath will not be set) USERPATH(path) set the current value of userpath to the folder passed in. It updates the current MATLAB path, and this new userpath will persist across MATLAB sessions. USERPATH('reset') resets the userpath to the default. It updates the current MATLAB path, and this new userpath will persist across MATLAB sessions. USERPATH('clear') removes the userpath. It updates the current MATLAB path, and this new userpath will persist across MATLAB sessions. Note that additional folders can be added to the top of the search path upon startup by specifying the path for the folders via the MATLABPATH environment variable. On Mac and Linux, if the directory $home/matlab exists, it will also be added to the search path after any folders specified via the MATLABPATH environment variable regardless of whether the MATLABPATH environment variable is set. (This is done for compatibility with earlier releases.) See also PATHDEF. Documentation for userpath doc userpath

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by