How to start MATLAB in terminal (Mac) with the folder where I start it as the initial working folder?
5 views (last 30 days)
Show older comments
When I start Matlab by typing matlab in the terminal on MacBook, the current folder is the last working folder from the previous session. In the Preferences-General, 'the last working folder from the previous MATLAB session' is checked. There is an option there to specify the initial folder, but I don't know how to specify the folder where Matlab is started. Is it possible?
In .bachrc, I have the following:
export MATLAB_USE_USERWORK=1
alias matlab='/Applications/MATLAB_R2017a.app/Contents/MacOS/MATLAB'
Is there any way to define the initial working folder to be the folder where Matlab is started from the terminal?
0 Comments
Accepted Answer
Walter Roberson
on 20 Jan 2018
Use the -sd or -useStartupFolderPref options. https://www.mathworks.com/help/matlab/ref/matlabmac.html
3 Comments
Walter Roberson
on 20 Jan 2018
alias matlab='/Applications/MATLAB_R2017a.app/Contents/MacOS/MATLAB -sd $(pwd)'
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!