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

답변 (1개)

Stephen23
Stephen23 2019년 4월 4일
편집: Stephen23 2019년 4월 4일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2019년 4월 4일

편집:

2019년 4월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by