您的位置:首页 > 编程语言 > MATLAB

How do I change the directory that MATLAB is initially started in?

2013-04-11 09:49 495 查看
http://www.mathworks.cn/support/solutions/en/data/1-17PSD/index.html?product=ML&solution=1-17PSD

How do I change the directory that MATLAB is initially started in?


Problem Description:

Depending on the version of MATLAB the default directory in which MATLAB for the PC starts varies.

As of MATLAB 5.3, MATLAB will start in the $MATLABROOT/work

For previous versions, by default MATLAB starts in $MATLABROOT/bin (where $MATLABROOT denotes the root directory of MATLAB).


Solution:

There are two main ways to change the directory in which MATLAB starts. Note on UNIX the directory is the same as the present working directory.

METHOD 1:

To change the directory in which MATLAB starts, you can use a 'startup.m' file.

For example if I wished to have all my MATLAB sessions start in D:\my_mfiles then I would place the following CD command in my 'startup.m' file:

cd D:\my_mfiles

For more information on the use of a STARTUP file please refer to the section titled "Starting MATLAB" in the Using MATLAB manual. You can also refer to the Related Solution for information on how to
use the STARTUP file to add paths to your MATLAB session.

METHOD 2 (only for Windows):

On the PC you can also set the Shortcut properties of the MATLAB icon to specify a 'Start in' directory. To do so, right-click on the MATLAB icon and select 'Properties'. Select the 'Shortcut' tab and place the directory that you wish to have MATLAB start in
into the 'Start in' field of the icon's properties.

在XP下,个人觉得第二种方式更简单实用,只用在快捷方式中更改路径即可。不用再做其他设置
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐