MATLAB 帮助中心
将启动文件添加到工程中
addStartupFile(proj,files)
addStartupFile(proj,files) 将启动文件添加到指定工程。当您打开工程时,启动文件会自动运行(如果它们是 .m 和 .p 文件)、加载(如果它们是 .mat 文件)或打开(如果它们是 Simulink® 模型)。
proj
files
.m
.p
.mat
示例
全部折叠
打开 Times Table App 工程。使用 currentProject 从当前加载的工程创建一个工程对象。
currentProject
openExample("matlab/TimesTableProjectExample") proj = currentProject;
通过使 runTheseTests.m 文件成为启动文件,即可在工程打开时自动运行 Times Table App。
runTheseTests.m
filepath = fullfile("utilities","runTheseTests.m"); addStartupFile(proj,filepath);
matlab.project.Project
工程,指定为 matlab.project.Project 对象。使用 currentProject 从当前加载的工程创建一个工程对象。
快捷方式文件的路径(包括文件扩展名),指定为字符串数组或字符向量元胞数组。文件必须在工程根文件夹中。如果文件不是工程文件,该函数会将其添加到工程中。
全部展开
从 R2025a 开始,addStartupFile 函数支持同时添加多个启动文件。
addStartupFile
currentProject | openProject | addShutdownFile | removeStartupFile
openProject
addShutdownFile
removeStartupFile
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处