Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: random sample of n rows from matrix
Date: Mon, 14 Dec 2009 08:56:23 -0500
Organization: The MathWorks
Lines: 21
Message-ID: <MPG.25900e10477e0356989a8d@news.mathworks.com>
References: <hg5f9j$nrl$1@fred.mathworks.com>
NNTP-Posting-Host: shurel.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1260798984 9258 172.31.57.214 (14 Dec 2009 13:56:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 14 Dec 2009 13:56:24 +0000 (UTC)
User-Agent: MicroPlanet-Gravity/2.70.2067
Xref: news.mathworks.com comp.soft-sys.matlab:592527

In article <hg5f9j$nrl$1@fred.mathworks.com>, uwn@sam.sdu.dk says...
> I have the following code:
> 
> m = [1 23, 2 34, 3 45, 4 43]
> 
> Now I want to draw a random sample of n rows from m.
> 
> I have tried the following:
> 
> sample = m(randperm(n))
> 
> but I only get values from the first column.
> 
> What is the correct proceedure?
> 

sample = m(randperm(n),:)

-- 
Loren
http://blogs.mathworks.com/loren