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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOperators and Elementary Operations についてさらに検索

製品

質問済み:

2021 年 3 月 30 日

編集済み:

2021 年 3 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by