Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Explain a code please

4 ビュー (過去 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