Counting an element in Matrix

I'm trying to simulate Fantasy 5 lotto and count the actual probability of each winnings (5 out of 5),(4 out of 5), and so on. I have this big Matrix of 600000 rows and 5 columns. I already simulated it and generated a quick pick to compare and see if I have a match on my simulated Fantasy 5 lotto.
% Simulation of Fantasy 5
% uses arrayfun to generate thousands of randperm
% uses cell2mat to display result
lotto = arrayfun(@(x)randperm(39,5),(1:600000)','UniformOutput',0);
display = cell2mat(lotto)
%Generate a random quick pick
quick = randperm(39,5)
%use ismember to determine if quick's results matches with simulated
%lotto results
matches = ismember(display,quick)
Now I have this 600000 rows and 5 columns of 0 zeroes and ones. I want to count the ones on each row and display how many ones are in each row. I tries using sum but it only counts the ones on each columns.

Answers (1)

Categories

Asked:

on 3 Apr 2014

Commented:

on 3 Apr 2014

Community Treasure Hunt

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

Start Hunting!