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 Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!