if i have a for loop doing iterations based on random intervals of time between .5-5 seconds, how do i keep track of that time?
4 views (last 30 days)
Show older comments
for i=1:60; x=(.5+4.5*rand)+x;
how do i figure out how much time went by during these 60 iterations?
0 Comments
Accepted Answer
Andrei Bobrov
on 29 Nov 2012
Edited: Andrei Bobrov
on 29 Nov 2012
x = cumsum(.5+4.5*rand(60,1));
or just
x = sum(.5+4.5*rand(60,1));
0 Comments
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!