For loop and omitting every 10th step
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Panty
am 20 Jan. 2015
Kommentiert: Panty
am 21 Jan. 2015
Hello,
I am doing some Bayesian by running a Gibbs sampler. My issue is that I would like to omit (drop) the draws I get in every 10th repetition. So I was wondering whether there is any command or trick while I am using the FOR command, to ignore or jump the every 10th repetition. So for example:
for i=1:30
I would i to take values 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29
Any idea? Many thanks
1 Kommentar
Stephen23
am 20 Jan. 2015
You should not use i or j as the loop variable name, as these are the names of the inbuilt imaginary unit .
Akzeptierte Antwort
Weitere Antworten (2)
David Young
am 20 Jan. 2015
for i = floor(1:10/9:30)
...
end
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!