number of times a value appears in an array or vector
24 views (last 30 days)
Show older comments
Jaskaran Dhaliwal
on 27 Feb 2020
Commented: Jaskaran Dhaliwal
on 27 Feb 2020
x = [1,2,3,4,5,6,7,8,9,10,10,10,10];
PlayersHand = [x(randi(length(x))),x(randi(length(x)))]
DealersHand = [x(randi(length(x)))]
I need something to tell me how many 1's appear in PlayersHand each time I run it
Thanks.
0 Comments
Accepted Answer
Adam Danz
on 27 Feb 2020
I need something to tell me how many 1's appear in PlayersHand each time I run it
count = sum(PlayersHand(:)==1);
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!