File Exchange

image thumbnail

samplepick

version 1.1.0.0 (1.6 KB) by Mauro
pick a random sample out of an array

0 Downloads

Updated 11 Mar 2010

View Version History

View License

To test al model, with real data it can be useful to pick a smaller sample out of a bigger dataset.

An other application could be to decide how small a random sample should be to see if the process is working property.

Cite As

Mauro (2021). samplepick (https://www.mathworks.com/matlabcentral/fileexchange/26889-samplepick), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Mauro

jep, and it's faster ;-) ...

Darren Rowland

The function randperm is practically ready-made for this application. To draw a subset, s, of size m from a dataset, d, of size n, one can simply do

perm = randperm(n);
s = d(perm(1:m));

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!