% LMex020203_4th.m
% Example 2.2.2 Throwing 2 dice p
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Writtten by Eugene Gallagher, Eugene.Gallagher@umb.edu
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% Written 9/17/2010 & last revised 1/13/2011
% What is the probability of rolling a 7 with two dice
% The dice are colored red and green, but that is irrelevant here.
% The curly brackets make V a cell-structured matrix allowing the 
% labels to be sorted as a unit.
V=[{'W1'};{'W2'};{'W3'};{'M1'};{'M2'}];
fprintf('Sample Space, with each sample outcome an ordered pair:\n')
% This is the built-in Matlab combination function. Since V is an input
% vector, not a scalar, all of the combinations of size 2 are output.
Outcomes=nchoosek(V,2)