I have 'M' users that have two different characteristics of N1 and N2 possible values for each case. I.E: A is a Mx1 vector that especifies the sex {'F','M'} (N1 = 2) of each user and B is a Mx1 vector that especifies the continent where the user lives {'ASIA','AFRICA','AMERICA',etc.} (N2 = 6). I want to create a N1xN2 (2*6) matrix that gives me the number of users for each combination of sex and continent without using a for loop. I've tried this code:
bsxfun(@eq,A,unique(A)')'*bsxfun(@eq,B,unique(B)')
But it is not what i need.
Thanks in advance.
PS: I do not need the cartesian product of the values, I need a matrix counting the elements for each combination.