random entry selection from a matrix
古いコメントを表示
how can I select any element randomly from a 1 x n matrix?
回答 (1 件)
Doug Hull
2012 年 7 月 23 日
0 投票
v = [1:10]
vi = randi(numel(v));
choice = v(vi)
1 件のコメント
Walter Roberson
2012 年 7 月 23 日
Doug, you missed your chance to say
choice = v(randperm(numel(v),1));
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!