フィルターのクリア

Random integer numbers using random function

1 回表示 (過去 30 日間)
KnowledgeSeeker
KnowledgeSeeker 2014 年 2 月 10 日
コメント済み: KnowledgeSeeker 2014 年 2 月 10 日
Hi, I am trying to obtain 9 random integer numbers and want them to be appeared in this form
expectedoutpt = '989898989' '897676767'
any suggestion?

採用された回答

Mischa Kim
Mischa Kim 2014 年 2 月 10 日
Something like:
function ri = rnum()
ri = num2str(randi([1,9],1,9));
ri = ri(~isspace(ri));
end
  1 件のコメント
KnowledgeSeeker
KnowledgeSeeker 2014 年 2 月 10 日
Thank you. works like a charm

サインインしてコメントする。

その他の回答 (1 件)

Jos (10584)
Jos (10584) 2014 年 2 月 10 日
Two strings of 9 random digits between 1 and 9 each (no 0?), stored in a row cell(?) array?
S = cellstr(char('0' + ceil(9*rand(2,9)))).'
  1 件のコメント
KnowledgeSeeker
KnowledgeSeeker 2014 年 2 月 10 日
Thank you.It works well

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by