Select random numbers from a matrix
12 ビュー (過去 30 日間)
古いコメントを表示
I want to select 100 random numbers from a certain column of a matrix. What should I do?
回答 (1 件)
Image Analyst
2017 年 12 月 16 日
Try this:
y = rand(1000, 3); % Some random data
% Select 100 numbers randomly from column 2:
selected = y(randperm(size(y, 1), 100), 2)
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!