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)
for i=1:60; x=(.5+4.5*rand)+x;
how do i figure out how much time went by during these 60 iterations?

Accepted Answer

Andrei Bobrov
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));

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!