登录论坛

查看完整版本 : 是否有Matlab函数在预设时间启动程序?


poster
2019-12-10, 20:48
是否有Matlab函数在预设时间启动程序?

例如,我想在14h00运行脚本runmyfile.m?



回答:

您可以创建一个调用代码的TIMER (http://www.mathworks.com/help/techdoc/matlab_prog/f9-38055.html)对象,然后使用STARTAT (http://www.mathworks.com/help/techdoc/ref/startat.html)函数在给定的时间启动脚本。

例如,如果要运行一个名为runmyfile.m的脚本:

t1=timer('TimerFcn','runmyfile'); startat(t1,'14:00:00');

更多&回答... (https://stackoverflow.com/questions/3662408)