classdef FunctionWrapper < handle
methods
function Fcn(obj)
disp( FunctionWrapper.Fcn was called! );
end
end
end
classdef TimerWrapper < handle
properties
Timer
end
methods
function obj = TimerWrapper(other_object)
obj.Timer = timer;
set(obj.Timer, Period , 1);
set(obj.Timer, ExecutionMode , fixedSpacing );
set(obj.Timer, TimerFcn , @(event, data) other_object.Fcn);
end
function start(obj)
start(obj.Timer);
end
function stop(obj)
stop(obj.Timer);
end
function delete(obj)
disp( destructor called! );
delete(obj.Timer);
end
end
end
Say I execute the following code in the Command Window:
>> F = FunctionWrapper;
>> T = TimerWrapper(F);
>> clear T %# T s destructor not called
>> timerfind %# just to verify that no, the destructor was never called
Timer Object: timer-1
Timer Settings
ExecutionMode: fixedSpacing
Period: 1
BusyMode: drop
Running: off
Callbacks
TimerFcn: @(event,data)other_object.Fcn
ErrorFcn:
StartFcn:
StopFcn:
这里的情况如何? 我知道
,因此为什么提及该代码? (从来就不要求主犯这一事实就意味着这一事实。) 这是否被掩埋在r子里?timer
物体需要人工删除,但我认为,在<代码>上将处理这些物体。 如果不使用,Amro ugly但直截了当地工作,以超载clear
tor,是否可从工作空间用clear T
? 此外,没有提及<代码>T