MATLAB 修改启动路径

本文介绍了在MATLAB中修改启动路径的几种方法,包括使用cd命令临时更改、userpath设置用户路径以及savepath保存搜索路径。详细阐述了各种命令的用法及示例,帮助用户理解如何管理和定制MATLAB的启动目录。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MATLAB修改启动有几种方法,其中包括临时的方法和永久性的方法,在这里简要介绍。

cd(change directory)

使用 cd命令,cd是dos系统下的改变路径的命令,全称是 change directory,使用cd命令可以直接的改变当前的工作路径,MATLAB的官方帮助文档说明如下:

cd

Change current foldercollapse all in page

Syntax

cd(newFolder)
oldFolder = cd(newFolder)
cd

Description

cd(newFolder) changes the current folder to newFolder.

oldFolder = cd(newFolder) returns the existing current folder as a string to oldFolder, and then changes the current folder to newFolder.

cd displays the current folder.

Input Arguments

newFolder
A string specifying the folder to which you want to change the current folder. Valid values can be any one of the following:
A full or relative path.
../, which indicates one level up from the current folder.
Multiple strings of ../, which indicates multiple levels up from the current folder.
./, which indicates a path relative to the current folder, although without the ./, cd assumes that the path is relative to the current folder.

Output Arguments

oldFolder
A string specifying the current folder that was in place when you issued the cd command.

Definitions

The current folder is a reference location that MATLAB® uses to find files. This folder is sometimes referred to as the current directory, current working folder, or present working directory.

Examples

Use cd with the matlabroot function to change the current folder to the examples directory for the currently running version of MATLAB:

cd(fullfile(matlabroot, ‘/help/techdoc/matlab_env/examples’))
On a Microsoft® Windows® platform, specify the full path to change the current folder from any location to the examples directory for MATLAB Version 7.11 (R2010b), assuming that version is installed on your C: drive:

cd('C:/Program Files/MATLAB/R2010b/
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值