It is not obvious why you are dividing V(ii) by 2 ? That part needs a comment.
Info
此问题已关闭。 请重新打开它进行编辑或回答。
Explain a code please
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!