Initial working folder not working?

조회 수: 120 (최근 30일)
Martin Guzman
Martin Guzman 2017년 4월 20일
댓글: Emil 2022년 12월 22일
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
diwakar pyakurel
diwakar pyakurel 2018년 4월 18일
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
Qingyu 2020년 3월 20일
Little Fox and diwakar's answer works, Thanks!

댓글을 달려면 로그인하십시오.

답변 (6개)

Steven Lord
Steven Lord 2017년 5월 15일
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.
If that shortcut has a blank "Start in" line, or if you're not launching MATLAB from a shortcut, check if you have a startup.m in your current directory that includes a cd call, or if your system administrator has added a call to cd to matlabrc.
  댓글 수: 3
shuang zhang
shuang zhang 2022년 1월 24일
Thank you so much. It's exactly like what you said. Now my matlab really works as I set.
Emil
Emil 2022년 12월 22일
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
Kevin 2018년 6월 27일
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
Viktor Marinkov
Viktor Marinkov 2021년 9월 14일
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
Yvan Becard 2022년 5월 26일
As @Thien-Minh Nguyen said, this solves two pains at once! Startup folder + one icon only in dock. Thanks!

댓글을 달려면 로그인하십시오.


ES
ES 2017년 4월 20일
For windows only:
How do you open up matlab? Using a shortcut? right click the shortcut to see the properties "Start In:"
  댓글 수: 3
Sndn_Shr
Sndn_Shr 2017년 11월 7일
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
John Harris 2018년 3월 26일
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
robobobeng 2017년 5월 26일
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
Bora Eryilmaz 2017년 6월 12일
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
SB
SB 2020년 11월 4일
Typo: It should say -useStartupFolderPref

댓글을 달려면 로그인하십시오.


Moritz Schappler
Moritz Schappler 2018년 3월 22일
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.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by