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?
1 view (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
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!