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!