Draw random cards from deck
19 views (last 30 days)
Show older comments
function[ deck ] = Career_Cards()
Career1 ='teacher (50,000)'
Career2 ='Accountant (70,000)'
Career3 ='Veterinarian (80,000)'
Career4 ='Lawyer (90,000)'
Career5 ='Salesperson (20,000)'
Career6 ='Mechanic (40,000)'
Career7 ='Police_Oficcer (50,000)'
Career8 ='Entertainer (60,000)'
Career9 ='Athlete (70,000)'
Career10 =' Doctor(100,000)'
deck = [Career1, Career2, Career3, Career4, Career5, Career6, Career7, Career8, Career9, Career10]
I need to figure out how to draw a random card from the following deck of cards.
0 Comments
Answers (1)
Ameer Hamza
on 19 Apr 2020
This shows how to draw a random card from the deck
deck = Career_Cards;
rand_card = deck{randi([1 numel(deck)], 1)};
function[ deck ] = Career_Cards()
Career1 ='teacher (50,000)';
Career2 ='Accountant (70,000)';
Career3 ='Veterinarian (80,000)';
Career4 ='Lawyer (90,000)';
Career5 ='Salesperson (20,000)';
Career6 ='Mechanic (40,000)';
Career7 ='Police_Oficcer (50,000)';
Career8 ='Entertainer (60,000)';
Career9 ='Athlete (70,000)';
Career10 =' Doctor(100,000)';
deck = {Career1, Career2, Career3, Career4, Career5, Career6, Career7, Career8, Career9, Career10};
end
0 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!