How to not save all iteration from a while-loop into a vector

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

Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Products

Asked:

on 30 Mar 2021

Edited:

on 31 Mar 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!