How do I set the default/initial working folder for MATLAB?

1,026 views (last 30 days)
How do I set the default/initial working folder for MATLAB?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Nov 2020
Edited: MathWorks Support Team on 1 Dec 2020
You can set the initial working folder in MATLAB through the following Preference settings:
1. Open the Preferences window
2. Navigate to the General options
3. Select the option to specify a path to a folder under the Initial working folder options, and enter the desired directory
4. Press Apply and/or OK to save your changes
5. Restart MATLAB to verify the new location is set as expected.
Additional information can be found in the MATLAB documentation:
MATLAB Startup Folder

Sign in to comment.

More Answers (5)

Felipe Delduqui
Felipe Delduqui on 14 Jun 2017
Just write this once:
userpath ('D:\my_mfiles')

Christos on 9 Mar 2018
Preferences -> MATLAB General Preferences
Change the Initial working folder

Garvit Amipara
Garvit Amipara on 2 Mar 2021
Edited: Garvit Amipara on 2 Mar 2021
Windows users-
If it does not work after making changes in the Preferences> Matlab>Current Folder- 'Path' then try this.
>Remove the quick launch icon that you are currently using to run Matlab (if you are using a desktop shortcut check the last step dierctly) .
>Go to Matlab installation directory > bin folder and look for 'matlab.application'
> Create a desktop shortcut from this icon (i.e. copy & paste on desktop)
>Right click on the icon on the desktop > go to Properties and look for 'Start in:' box, put the ''desired working directory path'' in here. Click OK.
Open from this shortcut and it should work.

Suzan Dilara Tokac
Suzan Dilara Tokac on 2 Apr 2020
I am analyzing an EEG data and getting similar error. I did everything commented before like setting the path/wd again, but stil...
Undefined function 'resample' for input arguments of type 'double'.
Error in eeg_autocorr_fftw (line 27)
resamp = resample(ac', 128, EEG.srate)';
Thank you in advance.
  1 Comment
Cody Lamke
Cody Lamke on 16 Apr 2020
Edited: MathWorks Support Team on 2 Feb 2021
If you are still experiencing this issue, please contact MathWorks support:
-Cody Lamke

Sign in to comment.

Erkan MSN
Erkan MSN on 4 Jan 2022
Edited: Erkan MSN on 4 Jan 2022
Hi, perhaps can maybe utility.
cd (uigetdir());


Find more on Startup and Shutdown 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!