Hello,
I want to gradually increase a FOR loop increment during a program.
For example:
for i=1:2:200
after 10 steps I want the step size increases automatically to 4
Thanks in advance

 Akzeptierte Antwort

Weitere Antworten (1)

KSSV
KSSV am 24 Sep. 2020

1 Stimme

val = [1:2:19,23:4:200] ;
N = length(val) ;
iwant = zeros(1,N) ;
for i = 1:N
iwant(i) = val(i) % In case you want to store some result out of it
end

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Sep. 2020

Beantwortet:

am 24 Sep. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by