필터 지우기
필터 지우기

a question about the for loop index

조회 수: 2 (최근 30일)
Mnr
Mnr 2015년 6월 24일
댓글: Mnr 2015년 6월 24일
Hello,
I would like to have a for loop with its index k ranging from e.g. 8 to 1 such that in the first iteration k=8, in the second iteration k=4, in the 3rd iteration k=2, and in the forth iteration k=1. I would appreciate your help. Thanks.

채택된 답변

Matt J
Matt J 2015년 6월 24일
for k=2.^(3:-1:0)
....
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by