Matlab 如果从当前工作区清除计时器对象,其回调函数是否仍会触发?

Matlab 如果从当前工作区清除计时器对象,其回调函数是否仍会触发?,matlab,timer,Matlab,Timer,如果使用从当前工作区清除计时器对象,其TimerFcn是否仍会在计划时间触发 clear不会删除对象,只删除引用该对象的变量。所以它没有效果: 您将在3秒钟后看到该图 要删除对象,请使用“删除”。这会导致Matlab停止计时器,因此不会执行计时器功能: 没有出现任何数字。事实上,你得到了非常明确的答案 Warning: You are deleting one or more running timer objects. MATLAB has automatically stopped the

如果使用从当前工作区清除计时器对象,其TimerFcn是否仍会在计划时间触发

clear不会删除对象,只删除引用该对象的变量。所以它没有效果:

您将在3秒钟后看到该图

要删除对象,请使用“删除”。这会导致Matlab停止计时器,因此不会执行计时器功能:

没有出现任何数字。事实上,你得到了非常明确的答案

Warning: You are deleting one or more running timer objects.  MATLAB has
automatically stopped them before deletion. 
close all
t = timer('TimerFcn', 'figure', 'StartDelay', 3); % create figure after 3 seconds
start(t)
pause(2)
delete(t)
Warning: You are deleting one or more running timer objects.  MATLAB has
automatically stopped them before deletion.