Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Explain a code please

7 visualizaciones (últimos 30 días)
Samuel Trinidad-Espinoza
Samuel Trinidad-Espinoza el 15 de Mzo. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Walter Roberson
Walter Roberson el 15 de Mzo. de 2018
It is not obvious why you are dividing V(ii) by 2 ? That part needs a comment.

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by