Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Do stuff without colons
Date: Tue, 9 Dec 2008 20:40:23 +0000 (UTC)
Organization: Xoran Technologies
Lines: 25
Message-ID: <ghml3n$eoe$1@fred.mathworks.com>
References: <ghmkpn$9ml$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228855223 15118 172.30.248.38 (9 Dec 2008 20:40:23 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Dec 2008 20:40:23 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:505946


"Pithawat " <tanvach+matlab@gmail.com> wrote in message <ghmkpn$9ml$1@fred.mathworks.com>...
> Hello, I'd like to know if anyone can help me with this seemingly simple problem...
> 
> I want to know if it's possible to swap colon notation with a built in function. Let me give an example:
> 
> a = randperm(100);
> b = a(1:10); % Choose only first 10 random permutations
> 
> Is it possible to combine these two lines into one:
> 
> b = function(randperm(100), 1:10);
> 
> or something along the line
> 
> b = randperm(100)(1:10);
> 
> This would really make my life so much easier!
> 
> Am I missing something here?
> 
> Pithawat


b=ceil(100*rand(1,10));