如何在Matlab启动时设置一些自定义变量 [英] How to set some custom variables on Matlab startup

查看:134
本文介绍了如何在Matlab启动时设置一些自定义变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在每次启动Matlab时自动设置一些初始变量(例如format compact和当前目录).
我该怎么办?

I would like to set some initial variables (like format compact and the current directory) automatically on each startup of Matlab.
How can I do that?

推荐答案

创建一个startup.m脚本文件,其中包含用于设置所需状态的命令.接下来,在MATLAB内部,运行命令

Create a startup.m script file containing the commands to set up the state that you want. Next, from inside MATLAB, run the command

>> userpath

这将为您提供一个或多个用户特定目录的列表(取决于您所使用的操作系统);将您的startup.m放在这些目录中的任何一个中,无论何时启动MATLAB都可以找到它(如果在启动MATLAB的目录中也可以找到startup.m,但是上述技术允许您从任意一个目录中启动MATLAB目录,并且仍然具有startup.m来运行).

This will give you a list of one or more user-specific directories (depending on what OS you are using); put your startup.m in any of those directories and it will be found whenever you start MATLAB (startup.m is also found if it is in the directory from which MATLAB is started, but the technique above allows you to start MATLAB from an arbitrary directory and still have startup.m get run).

这篇关于如何在Matlab启动时设置一些自定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆