Be the first to rate this file! 8 downloads (last 30 days) File Size: 1.6 KB File ID: #26889

samplepick

by Mauro

 

09 Mar 2010 (Updated 11 Mar 2010)

Code covered by the BSD License  

pick a random sample out of an array

Download Now | Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.9 (2009b)
Zip File Content  
Other Files license.txt,
samplepick.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
10 Mar 2010 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));

10 Mar 2010 Mauro

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

Please login to add a comment or rating.
Updates
11 Mar 2010

works now with randperm

Tag Activity for this File
Tag Applied By Date/Time
statistics Mauro 09 Mar 2010 11:00:47
simulation Mauro 09 Mar 2010 11:00:47
random Mauro 09 Mar 2010 11:00:47
sample Mauro 09 Mar 2010 11:00:47
samples Mauro 09 Mar 2010 11:00:47
sampling Mauro 09 Mar 2010 11:00:47
test Mauro 09 Mar 2010 11:00:47
pick Mauro 09 Mar 2010 11:00:47
choose Mauro 09 Mar 2010 11:00:47
snap Mauro 09 Mar 2010 11:00:47
grab Mauro 09 Mar 2010 11:00:47
control Mauro 09 Mar 2010 11:00:47
allocate Mauro 09 Mar 2010 11:00:47
take Mauro 09 Mar 2010 11:00:47
draw Mauro 09 Mar 2010 11:00:47
ratio Mauro 09 Mar 2010 11:00:47
fraction Mauro 09 Mar 2010 11:00:47

Contact us at files@mathworks.com