Random data selection from a matrix
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tinkul
am 8 Mär. 2014
Kommentiert: Image Analyst
am 8 Mär. 2014
How can i select 5 datasample from the matrix
Z=[43;-57;98;23;-13;243;-98;112;325;560]
Akzeptierte Antwort
Image Analyst
am 8 Mär. 2014
Try this:
Z=[43;-57;98;23;-13;243;-98;112;325;560]
elementsToExtract = randperm(numel(Z), 5)
z5 = Z(elementsToExtract)
3 Kommentare
Image Analyst
am 8 Mär. 2014
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))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!