Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
simple randome sampling without replacement

Subject: simple randome sampling without replacement

From: amira ali

Date: 29 Mar, 2012 10:20:17

Message: 1 of 4

hello
 have large data set and i want to minimize it by using standard random sampling
how can i do that
 anyone reply to me

Subject: simple randome sampling without replacement

From: Roger Stafford

Date: 29 Mar, 2012 21:59:24

Message: 2 of 4

"amira ali" wrote in message <jl1d11$f0g$1@newscl01ah.mathworks.com>...
> have large data set and i want to minimize it by using standard random sampling
> how can i do that
- - - - - - - - -
  If k of them are to be removed, do

 data(randperm(numel(data),k)) = [];

(This presupposes you have a sufficiently recent matlab version.)

Roger Stafford

Subject: simple randome sampling without replacement

From: Greg Heath

Date: 29 Mar, 2012 22:20:45

Message: 3 of 4

On Mar 29, 6:20 am, "amira ali" <amiraali2...@gmail.com> wrote:
> hello
>  have large data set and i want to minimize it by using standard random sampling
> how can i do that
>  anyone reply to me

randdatacols = data(:,randperm(size(data,2)));
or
randdatarows = data(randperm(size(data,1)), :);

Hope this helps.

Greg

Subject: simple randome sampling without replacement

From: Peter Perkins

Date: 3 Apr, 2012 15:08:48

Message: 4 of 4

On 3/29/2012 6:20 AM, amira ali wrote:
> hello have large data set and i want to minimize it by using standard
> random sampling
> how can i do that anyone reply to me

As others have posted, you can use randperm.

However, if you have access to a relatively new version of the
Statistics Toolbox, you can also use the datasample function, which
supports not only uniform sampling without replacement, but weighted
sampling, and with replacement sampling.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us