could anyone help me how to randomly select the values.

1 回表示 (過去 30 日間)
jaah navi
jaah navi 2019 年 6 月 5 日
回答済み: Alex Mcaulley 2019 年 6 月 5 日
I am having
b= 1
3
4
5
8
9
10
11
13
15
I want to randomly select any 5 values from b and i need it to display it in single row
i used the command randi(b,1,5)
but unable to get the result.
could anyone please help me on it.

採用された回答

Alex Mcaulley
Alex Mcaulley 2019 年 6 月 5 日
Try this:
res = b(randi(numel(b),1,5))';

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by