Random data selection from a matrix
1 次查看(过去 30 天)
显示 更早的评论
How can i select 5 datasample from the matrix
Z=[43;-57;98;23;-13;243;-98;112;325;560]
采纳的回答
Image Analyst
2014-3-8
Try this:
Z=[43;-57;98;23;-13;243;-98;112;325;560]
elementsToExtract = randperm(numel(Z), 5)
z5 = Z(elementsToExtract)
3 个评论
Image Analyst
2014-3-8
You must have a really old version of MATLAB. What version/release do you have? You can extract the 5 yourself:
Z=[43;-57;98;23;-13;243;-98;112;325;560]
elementsToExtract = randperm(numel(Z))
z5 = Z(elementsToExtract(1:5))
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!