How to not save all iteration from a while-loop into a vector
Mostrar comentarios más antiguos
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
Respuestas (0)
Categorías
Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!