manage time computing
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I would like to manage the computing time of a function. For example :
function y = myfun(x)
y = something_long_to_calculate(x);
return
and I would like my main code to do something like:
lim = 5; %time limit in sec
x = 0;
tic;
while toc<lim
y = myfun(x);
end
Obviously, I wouldn't work, the point is how could you limited the time of calculation. In this case, if y should have been a vector 100x1 and the program would just have had time to compute the 10 first iterations, how could I still got those values ?
thx
0 commentaires
Réponse acceptée
Walter Roberson
le 20 Déc 2011
That looks like it would work. For a different coding, see http://www.mathworks.com/matlabcentral/answers/21721-constructing-for-loop-in-terms-of-seconds
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Downloads dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!