Increment change For loop

22 ビュー (過去 30 日間)
Amir Ehsani
Amir Ehsani 2020 年 9 月 24 日
回答済み: KSSV 2020 年 9 月 24 日
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

採用された回答

David Hill
David Hill 2020 年 9 月 24 日
for i=[1:2:19,23:4:200]
end

その他の回答 (1 件)

KSSV
KSSV 2020 年 9 月 24 日
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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by