Path: news.mathworks.com!not-for-mail
From: "Pithawat " <tanvach+matlab@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Do stuff without colons
Date: Tue, 9 Dec 2008 20:35:03 +0000 (UTC)
Organization: Univ of Oxford
Lines: 20
Message-ID: <ghmkpn$9ml$1@fred.mathworks.com>
Reply-To: "Pithawat " <tanvach+matlab@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228854903 9941 172.30.248.35 (9 Dec 2008 20:35:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Dec 2008 20:35:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 330324
Xref: news.mathworks.com comp.soft-sys.matlab:505942


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