Prev: How to set the seed as a 128 binary string of psudo random numbergenerator (randn)
Next: convolved audio cut in half and plotting problems
From: Shahar on 6 Jun 2010 11:17 Hi, Is it possible to execute a new timer within another timer? When I try to do so, the new timer won't run until the "ancestor" timer finish. Any way that the new timer will execute in parallel with its parent timer? In code: I get to the %Not row before I get to the %Desired row. the 'Got Here!' message won't display until MyMain function finish, although the new timer is initialized 4 seconds before and the period is 1 second. Is there any way to overcome this? Thanks in advance, Shahar. function TestScript timer1 = timer('ExecutionMode', 'fixedSpacing', ... 'Name', 'MainTimer', ... 'BusyMode', 'drop', ... 'StartDelay', 5, ... 'TimerFcn', @MyMain, ... 'Period', 15); start( timer1 ); function MyMain( obj, event ) timer2 = timer('ExecutionMode', 'fixedSpacing', ... 'Name', 'SecondaryTimer', ... 'BusyMode', 'queue', ... 'StartDelay', 1, ... 'TimerFcn', @MySecondary, ... 'Period', 1); start( timer2 ); pause(2); disp('Still haven''t finished running!'); %Not pause(2); function MySecondary( obj, event ) disp('Got Here!'); %Desired |