I wrote this code to count wins and losses but i need to save the W or L to a matrix.
for g=1:num_games
if scores(g,6) > scores(g,7)
disp('W')
else
disp('L')
end
end

Respuestas (1)

Stephen23
Stephen23 el 4 de Abr. de 2019
Editada: Stephen23 el 4 de Abr. de 2019

0 votos

No loop required:
V = 'LW';
Z = V(1+(scores(:,6)>scores(:,7)))

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 4 de Abr. de 2019

Editada:

el 4 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by