Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

I want my loop to run backward and print all values which are before 5.

조회 수: 1 (최근 30일)
Ralph
Ralph 2020년 8월 29일
마감: MATLAB Answer Bot 2021년 8월 20일
for i=5:9:last_index
for j=5:-1:1
d=j;
end
end
I want my loop to run backward and print all values which are before 5 and store all the values in variable d. I have written the above code for it but its not working

답변 (1개)

Alan Stevens
Alan Stevens 2020년 8월 29일
Try
d(j) = j;
instead of
d = j;
to store all values of j.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by