Info

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

Explain a code please

조회 수: 7 (최근 30일)
Samuel Trinidad-Espinoza
Samuel Trinidad-Espinoza 2018년 3월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
clear, clc
V = [-5 14 8 -13 12 0 -2];
SUM = 0;
for ii = 1:length(V)
if V(ii) <= 0
continue
end
SUM = SUM + V(ii)/2;
fprintf('index = %d, SUM = %d \n', ii, SUM)
end
I know the answers but can someone explain how to get them on paper. Mot importantly is V(ii) an index matrix? Do i divide 1:7 by 2?
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 3월 15일
It is not obvious why you are dividing V(ii) by 2 ? That part needs a comment.

답변 (0개)

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

Community Treasure Hunt

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

Start Hunting!

Translated by