Picking a random row of a matrix
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a matrix Y that's nx2. Say in this case n=5. (n can only take the values 3,5 or 8 but I guess that doesn't matter)
Y =
9 2
10 2
9 3
9 4
10 4
I want to randomly choose on of these rows so I can use them as coordinates!
Many thanks,
Phill
0 件のコメント
採用された回答
James Tursa
2019 年 11 月 27 日
編集済み: James Tursa
2019 年 11 月 27 日
k = randi(size(Y,1)); % the random row index
Y(k,:) is the random row
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
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!