1)需要该功能在下午1:00:10开始 2)需要该函数以每10秒的倍数重新运行(但是该函数运行超过10秒,需要它跳过它并转到下一个10秒开始)...
目前这不起作用
persistant 10SecStart
if isempty(10SecStart)
10SecStart = '01:00:10';
end
t1=timer('TimerFcn','runmyfile');
startat(t1,10SecStart);
tic
FUNCTION HERE % Should take less than 10 Seconds, but sometimes is more than 10 Sec but less than 20 seconds.
toc
toc = elapsedTime;
if elapsedTime < '00:00:10'
10SecStart = 10SecStart + '00:00:10'
else
10SecStart = (10SecStart + ('00:00:10'- elapsedTime) + '00:00:10' )
end
答案 0 :(得分:1)
您要实施的是fully supported by the timer object。将@Component
public class Foo implements Bar {
@Activate
void activate(ComponentContext ctx) {
System.out.println("Activating bundle: " + ctx.getUsingBundle());
}
@Deactivate
void deactivate(ComponentContext ctx) {
System.out.println("Deactivating bundle: " + ctx.getUsingBundle());
}
}
设置为BusyMode
会导致跳过下一次执行,以防前一次执行未完成。