MATLAB: How to select last working directory as initial working folder in the next startup of MATLAB for GNU/Linux

desktop launchergnu/linuxinitial working folderlinuxMATLABr2018bstartup folderUbuntu

Hello, I have just installed MATLAB and Simulink R2018b release on my laptop which runs an Ubuntu based Linux distro.
After the installation I ran the following command
sudo apt-get install matlab-support
which made a startup launcher that basically runs this command
matlab -desktop
The problem is that every time I run MATLAB using the launcher, MATLAB's initial working folder is the home folder and every time I run MATLAB using the command line from a certain path, MATLAB starts with that path as initial folder! But, this happens even if in Preferences -> General -> Initial Working Folder I select "Last working folder from previous MATLAB session" (that is what I want) or a custom path.
As I said before, what I want is that at every startup the current folder in MATLAB is the last folder I was in before MATLAB was closed…
Regards

Best Answer

I found the solution. Simply, the launcher need to run this command:
matlab -desktop -useStartupFolderPref