How to apply stop time condition with multiple time intervals?
Mostrar comentarios más antiguos
n=100;
tic
Time = 0;
for i = 1:n
if Time >= 35
fprintf('You run out of time')
break
end
A = rand(12000,4400);
Time1 = toc;
B = rand(12000,4400);
tic
C = A.*B;
Time2 = toc;
tic
D = A./B;
Time3 = toc;
E = A.*A;
tic
E = B.*B;
Time4 = toc;
Time = Time1 + Time2 + Time3 + Time4;
end
I want to stop the code when Time = 35 sec, I have tried the above but my code is not terminating the code at specified time?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!