can anyone help me to sort out the problem here
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
rem ng
el 3 de Feb. de 2019
Comentada: rem ng
el 4 de Feb. de 2019
In this Ex. i want all the functions under r loop to run for each r iteration (taken one at a time till rmax) with specific execution time not the iteration time for the whole r loop. I mean say r=3, if all operation under iteration r=3 should run for 0.5sec then how should i o for it. Thanks in advance.
Ex: rmax=1000
n=100
for r=0:1:rmax
(some operation)
for i=1:1:n
(some operation)
if (some condition)
end
end
end
2 comentarios
Respuesta aceptada
Walter Roberson
el 3 de Feb. de 2019
TT = tic;
while toc(TT) < timelimit
do more of the calculation
end
4 comentarios
Walter Roberson
el 3 de Feb. de 2019
It depends on how accurate you need the timing to be. If you have
TT = tic;
while toc(TT) < timelimit
for K = 1 : r
do more of the calculation
end
end
then the time spent in the for loop would be r times how long it takes to do each iteration, and that would determine how often toc was checked. Typically larger r would be more efficient but would lead to toc being checked less often.
Más respuestas (1)
KALYAN ACHARJYA
el 3 de Feb. de 2019
Editada: KALYAN ACHARJYA
el 3 de Feb. de 2019
If you want to change the execution time for the iterations, you can look for indexing (avoid loop if possible) or use the functions and call in the current scripts.
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!