フィルターのクリア

"converting" randit to randi

2 ビュー (過去 30 日間)
cgo
cgo 2016 年 1 月 5 日
回答済み: Star Strider 2016 年 1 月 5 日
I have this function
a = randint(1,1,actions)+1;
actions = [-1, 0 ,1];
It is not working in R2013b, so I am guessing this is already an obsolete function.
I would like to 'convert' it to 'randi' function that is used here, how would this look like?
Thanks

回答 (1 件)

Star Strider
Star Strider 2016 年 1 月 5 日
What do you want to do?
To create a (1x10) vector of random integers from 1 to 100, a randi call would be:
rv = randi(100, 1, 10);
to create a similar vector with random integers from 25 to 75, this works:
rv = randi([25 75], 1, 10);

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by