Initial working folder not working?
Mostrar comentarios más antiguos
So I want to have a folder that always opens up when I start up MATLAB. I went on Preferences>General and I've tried both "Last working folder.." and a specific folder, but it still opens up some random folder.
There has to be a way to fix this, its bugging me way to much. R2017a - Version I'm running
6 comentarios
Jan
el 20 de Abr. de 2017
Is it really "some random folder"? This is very strange.
Martin Guzman
el 20 de Abr. de 2017
Oscar Julian Gonzalez Villarreal
el 15 de Mayo de 2017
I can confirm that this is happening to me too in R2017a version and it wasn't happening in R2016b. Does anyone know the solution to this? The only form I can get it to work is through cmd matlab -useStartupFolderPref command.
Little Fox
el 2 de Ag. de 2017
To fix it, right click your Matlab icon, select properties->shortcut, in "start in", delete the default folder. Now the preference setting should work.
diwakar pyakurel
el 18 de Abr. de 2018
To fix it, right click your Matlab icon, select properties->shortcut, in "start in", delete the default folder. Now the preference setting should work. ok it works.
Qingyu
el 20 de Mzo. de 2020
Little Fox and diwakar's answer works, Thanks!
Respuestas (6)
Steven Lord
el 15 de Mayo de 2017
20 votos
If you're on Windows and are launching MATLAB using a shortcut, right-click the shortcut you use to start MATLAB and open the Properties of that shortcut. Check the "Start in" line on the Shortcut tab. It should be blank. If it is not blank, it should contain the name of the "random folder" in which MATLAB starts.
3 comentarios
Jon
el 19 de Jul. de 2021
Hi Steven,
Thanks so much. I was just experiencing exactly the same issue (MATLAB initial working directory not the last one I left off in inspite of preference setting to do this). Clearing out the "Start In" line on my Shortcut tab immediately resolved the problem.
Your answer should probably be marked as "Accepted" maybe you have enough privileges to do this, so that others will easily find it too.
Thanks again this was a very annoying problem and it was great to find a quick answer
shuang zhang
el 24 de En. de 2022
Thank you so much. It's exactly like what you said. Now my matlab really works as I set.
Emil
el 22 de Dic. de 2022
Have the same problem on multiple Windows 10 machines with multiple versions of matlab 2011b(32/64) 2017A.
the startup.m doesn't contain any cd calls and the matlabrc has not been modified - there is one cd call there to the default folder - not sure if it always takes that path?!?
Matlab starts with the icon click - doesn't matter what folder I put in the Start in: right click on the icon -> Properties-> Start in: field
Doesn't matter if I click the check box in the matlab properties or put a folder name there.
I used to be able to start in different folders - have different path files in those and run different lib versions - now I can't do any of that - matlab always starts in the default - no matter what I do.
Re-added the icon on the desktop - clear the field - put new folder - just some random - still the same thing - matlab starts in the default folder.
Is there any other thing I can/need to check?
Kevin
el 27 de Jun. de 2018
I, too, experienced the same problems despite changing the appropriate settings in Preferences for MATLAB R2018a on Ubuntu 18.04. The problem was fixed for me by using the -useStartupFolderPref flag as mentioned above. For future reference, my working Ubuntu .desktop launcher file now reads:
[Desktop Entry]
Type=Application
Icon=/usr/share/icons/matlab.png
Name=MATLAB R2018a
Comment=Start MATLAB
Exec=matlab -desktop -useStartupFolderPref
Categories=Development;
StartupNotify=true
StartupWMClass=MATLAB R2018a - academic use
The "StartupWMClass" line fixes the potential presence of many instances of MATLAB open in the dock.
6 comentarios
Jake Moss
el 29 de Abr. de 2020
I have been searching for ages for a solution, this is the only thing that has worked.
Thien-Minh Nguyen
el 30 de Mayo de 2020
This solves both the pains in one go.
To newbies like me, this is what you do on unbuntu 18.04:
After installing Matlab, in the Command Window, input
userpath('/your/preferred/startup/directory')
Then open file /usr/share/applications/matlab.desktop (or create a new one) and change its content to that in Kevin's comment above. You can change R2018a to your release version.
The app can now start in your preferred folder, and all instanaces are grouped under the same launcher icon.
Gregory King
el 12 de Dic. de 2020
Worked for me on Ubuntu 20.04 -- thanks!
Julio Cesar Gonzalez-saenz
el 28 de Mzo. de 2021
In Ubuntu 20.04, for matlab release 2021a, I have to add the window class: com-mathworks-util-PostVMInit.
Otherwise, the launcher did not show the .desktop.
Viktor Marinkov
el 14 de Sept. de 2021
Installing the matlab-support package creates a launcher in /usr/share/applications/matlab.desktop to which you have to add the flag above (-useStartupFolderPref). Thanks for the tip!
Yvan Becard
el 26 de Mayo de 2022
As @Thien-Minh Nguyen said, this solves two pains at once! Startup folder + one icon only in dock. Thanks!
ES
el 20 de Abr. de 2017
3 votos
For windows only:
How do you open up matlab? Using a shortcut? right click the shortcut to see the properties "Start In:"
3 comentarios
Martin Guzman
el 20 de Abr. de 2017
Sndn_Shr
el 7 de Nov. de 2017
Same is available for taskbar. When you right-click on the icon in taskbar, Matlab and unpin options show in a menu right? There, right click again on Matlab and go to properties.
John Harris
el 26 de Mzo. de 2018
I did this to fix my taskbar shortcut:
- closed matlab
- unpinned matlab from my taskbar
- put an icon on the desktop and cleared the 'start in' folder
- drug the icon to the taskbar
robobobeng
el 26 de Mayo de 2017
1 voto
Well, clearing the content of the "Start in" line fixed the problem for me. (version R2017a as well). Thank you very much Steven Lord!
Bora Eryilmaz
el 12 de Jun. de 2017
1 voto
The Initial Working Folder preferences on the Preferences > General panel will only be active when you start MATLAB:
- From a (Windows) shortcut with no "Start in" folder specified in the shortcut properties dialog. Otherwise, the folder specified in "Start in" takes precedence.
- From a terminal window with the -userStartupFolderPref flag
In all other cases, MATLAB startup folder will behave as in previous releases.
1 comentario
SB
el 4 de Nov. de 2020
Typo: It should say -useStartupFolderPref
Moritz Schappler
el 22 de Mzo. de 2018
1 voto
Since the previous answers focus on Windows: For Matlab R2017b on Ubuntu 16.04, I was able to fix the problem with the command `userpath` in Matlab.
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!