timer with varying periods
Show older comments
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});
3 Comments
Jan
on 19 Dec 2012
What are "varying intervals"? Do you want to start the timer at time=47 sec and stop it 6 seconds later?
Daniel Shub
on 19 Dec 2012
There currently is not enough information to answer this question. Please edit the question and reopen.
Accepted Answer
More Answers (1)
Martin Grden
on 7 Oct 2020
TimerFcn(objh,event)
...
% at the end of your TimerFcn:
stop(opjh);
opjh.Period=newPeriod;
opjh.StartDelay=newPeriod;
start(opjh);
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!