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 ExchangeLoops 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