How to set a folder as Current folder for every startup of Matlab?

后端 未结 4 528

I would like to set the folder /Users/ALJI/MATLAB as a default current folder for Matlab. I mean on every start up Matlab should point to this folder. is it pos

相关标签:
4条回答
  • 2021-01-14 04:23

    I finally found it.

    You edit a file named startup.m in /matlabrootfolder/toolbox/local and I add cd /Users/ALJI/MATLAB.

    It worked, hope this help :)

    0 讨论(0)
  • 2021-01-14 04:36

    Easier: You can see the default path by typing

    userpath
    

    If you create a variable named for example NewPath and assign the path you want to set as default:

    NewPath = 'Users/You/Desktop/Projects';
    

    you can then call :

    userpath(NewPath);
    

    restart matlab and the trick is done.

    0 讨论(0)
  • 2021-01-14 04:39

    Defining actions that will be done each time you start matlab can be done in a very fast and easy way.

    When you start matlap type:

    edit startup
    

    If it does not exist, create it. The commands in this file will be ran on every startup of matlab.

    In your case you may also want to check help cd for instructions on changing the directory programmatically.

    0 讨论(0)
  • 2021-01-14 04:40

    In addition to startup as answered by @Dennis, there's also the matlabrc file. That's what you should use if you need the setup to apply to all users:

    On multiuser or networked systems, system administrators can put messages, definitions, or other code that applies to all users in their matlabrc.m file.

    The file matlabrc.m invokes the startup.m file, if it exists on the search path MATLAB uses.

    Individual users should use the startup.m file to customize MATLAB startup. The matlabrc.m file, located in the matlabroot/toolbox/local folder, is reserved for system administrators

    0 讨论(0)
提交回复
热议问题