from Solution to Project Euler Problem 54 by Husam Aldahiyat
How many hands did player one win in the game of poker?

get_onepv(c)
function v = get_onepv(c)
	% get value of one pair hand
	
	cn = findv(c);
	
	a = unique(cn);
	
	% loop through cards
	for k = 1:4
		
		% see which card is repeated
		if sum(ismember(cn,a(k))) == 2
			
			% hand value is said card value
			v = a(k);
			
		end
		
	end	
	
end

Contact us at files@mathworks.com