MATLAB: Timer with varying periods

MATLABtimer

Hi all!
I am running a test setup where I need to take measurements at varying intervals that are between the values of 47 < T < 53 seconds.
By this I mean, the period between executions of TimerFcn is not a constant value, rather a random value between 47 and 53.
Do you guys know if this is possible with the timer function?
I checked the 'Period' property of Timer(), and it takes a double value, not a function.
This is how I have my code set up right now.
getMeasurementsTimer = timer();
set(getMeasurementsTimer, 'executionmode', 'fixedRate', 'period', data);
set(getMeasurementsTimer, 'StartFcn', {'startTest', hObject});
set(getMeasurementsTimer, 'TimerFcn', {'getTemp', hObject});

Best Answer

I don't know of this being possible, but it is certainly a good idea for an enhancement request.
Here is how I would tackle this:
  1. Have the timer only execute once, i.e. 'TasksToExecute' = 1.
  2. In the 'TimerFcn' have it start a new timer with a StartDelay equivalent to your new period.
  3. Finally at the end of the 'TimerFcn', have it delete the timer calling it so you don't end up with hundreds of timers