How to not save all iteration from a while-loop into a vector
Afficher commentaires plus anciens
I am trying to use Mod function in matlab in order to save every 100th or 1000th value from while-loop and save it in a new vector x. Any ideas how?
while t(i) < tf
w = prop_vilar(x(i, :), p);
a0 = sum(w);
u1 = rand(1);
u2 = rand(1);
tao = -log(u1)/a0;
r = length(find(cumsum(w) < a0*u2)) + 1;
x(i+1, :) = x(i, :) + n(r, :); % new vector
t(i+1) = t(i) + tao;
i = i+1;
end
Réponses (0)
Catégories
En savoir plus sur Operators and Elementary Operations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!