How to set a folder as Current folder for every startup of Matlab?

40 visualizaciones (últimos 30 días)
I would like to set the folder /Users/ALJI/MATLAB as a default current folder for Matlab. I mean on every start up Matlab should point to this folder. is it possible ? is there a way on Mac OS X ?
I am using Matlab r2009b on Mac OS X Snow Leopard.
thank you in advance

Respuesta aceptada

Wayne King
Wayne King el 28 de Mzo. de 2014
Editada: Wayne King el 28 de Mzo. de 2014
On MAC OS try changing the file of userpath(), which I think defaults to your Documents directory, you can confirm this by entering
>>userpath
at the command line.
>>userpath('/Users/ALJI/MATLAB');
should persist across MATLAB sessions.
Or read this:

Más respuestas (7)

Amar Neçaibia
Amar Neçaibia el 19 de Feb. de 2018
To fix this problem, right click your Matlab icon, select Properties->shortcut, in "start in", delete the default folder and put the directory that you want its work.
  8 comentarios
Veselin
Veselin el 1 de Jun. de 2023
Nothing else works, but this. Thanks
Yalc Copper
Yalc Copper el 15 de Jul. de 2023
thx, that really works for me.

Iniciar sesión para comentar.


Bora Eryilmaz
Bora Eryilmaz el 12 de Nov. de 2015
Starting in R2014b there is a MATLAB preference for doing this. Open the Preferences dialog from the Home tab in MATLAB and select MATLAB/General preferences tree node on the left side of the dialog. The General preference panel has an option to select the "Initial working folder".

joshua alviando
joshua alviando el 9 de Mzo. de 2020
first, open the file location of your matlab.exe
after that, create shortcut to whatever location (example : desktop)
then right click the shortcut icon and double click properties
in Shortcut bar, you can find start in text input, just paste your desire location
finally, you can pin the shortcut to taskbar for easy access
cheers ^^
  5 comentarios
Mahnoor Saeed
Mahnoor Saeed el 31 de Mzo. de 2021
Work for me Windows 10.
Thankyou so much for detailed guidline :)
Michaela Konstantinou
Michaela Konstantinou el 21 de Jul. de 2023
is there any way to do this programmatically?

Iniciar sesión para comentar.


Andrej Trost
Andrej Trost el 30 de Ag. de 2019
I'm using 2019a and Amar Neçaibia provided THE solution:
"To fix this problem, right click your Matlab icon, select Properties->shortcut, in "start in", delete the default folder and put the directory that you want its work."

sajjad hosseinifard
sajjad hosseinifard el 15 de Feb. de 2018
I'm using Matlab 2017b on windows 10. its startup folder is C:\Program Files\MATLAB\R2017b\bin. I want to change it but I have not succeeded yet!!! I tried it with using preference settings and userpath() command but this folder is not changed!!! Please someone help me!
  3 comentarios
Christian Hurtig
Christian Hurtig el 3 de Abr. de 2018
I have a similar problem, though I end up in the system32 folder when running matlab from the start menu. The "initial working folder" doesn't seem to change the current working directory on start up. The shortcut option suggested by Amar works.
Marco Cadei
Marco Cadei el 15 de Abr. de 2018
I think that there might be a bug because even on my PC modifying the "Initial working folder" preference in the General category of the preferences for MATLAB and applying that change didn't cause MATLAB to start in that directory. I did what Amar suggested and it work instead. I am using MATLAB R2018a on Windows 10

Iniciar sesión para comentar.


Yuliano Moscoso Yarin
Yuliano Moscoso Yarin el 10 de Abr. de 2019
I have the same issues even trying differents methos like "Initial working folder" preference in the General or the start in option on propertie with outh any luck...

geofo
geofo el 8 de Feb. de 2022
If you want a program to start in the directory /home/abc/def, just write in the first line of the source code:
cd /home/abc/def
The syntax works under Windows, Mac and Ubuntu but of course the directories are usually different, so you cannot have one code that just works on all platforms.
For example you can write in Windows a start path in the source code (you can write with forward or backwards slash, it works):
cd c:/mycode/maindir

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by