Trying to learn Rand - help get me started
5 ビュー (過去 30 日間)
古いコメントを表示
Hi, I'm trying to learn Matlab so I be more useful as an intern. Looking through the book I bought theres some practice - i have trouble with the following one, which is a "try this" problem and do they don't actually tell you how to do it:
Use an Array of characters 'A234567890JQK' to display a single random playing card. Hint: use a random number as an index value. Note that A = ace, 0 = 10, J = jack, Q = queen, and K = king. In oter words, your expression should randomly display a single character in the array.
So far I know how to put numbers in arrays, but characters? Can someone explain a way how to do so?
Thanks
0 件のコメント
採用された回答
the cyclist
2011 年 9 月 8 日
>> arrayOfAllCardRanks = 'A234567890JQK'
defines an array of characters, of size 1x13
I suggest using the randi() function for your next step, but won't give you the details.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!