MATLAB: How to find , using a table (of football results), how many time the home team has won to the nearest percent?

statisticsStatistics and Machine Learning Toolbox

Best Answer

Is "tab" a matrix of doubles, or a table?
To get the home team wins and losses, you can extract columns 6 and 7, then compare, sum, and round to the nearest integer:
percentHomeWins = round(100 * sum(tab(:,6)>tab(:,7)) / size(tab, 1));
This doesn't take into account the number of wins "by team number" like my other answer.