Filter/identify characters within a cell array
Afficher commentaires plus anciens
Say you have a cell array:
cell_array={'Kh','8h','8d','Kd','Ks'}
where h=hearts, d=diamonds, s=spades. In poker, the given combination would correspond to a full house (i.e. a pair and a set).
How do I identify a full house and not a set, a pair or two pairs?
As of now, I identify a set by searching for 3 identical values, e.g. three kings:
idKings=cellfun(@(x)any(ismember('K',x)),cell_array);
if sum(idKings)==3;
...
end
but how do I apply rules such that a full house is identified, and not a pair, a set or two pairs?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Elementary Math dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!