Path: news.mathworks.com!not-for-mail
From: "Lorenzo Guerrasio" <lorenzo.guerrasio@email.it>
Newsgroups: comp.soft-sys.matlab
Subject: vector operation, selecting chunks
Date: Fri, 20 Mar 2009 16:20:17 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <gq0fo1$l89$1@fred.mathworks.com>
Reply-To: "Lorenzo Guerrasio" <lorenzo.guerrasio@email.it>
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 1237566017 21769 172.30.248.38 (20 Mar 2009 16:20:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 20 Mar 2009 16:20:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1371978
Xref: news.mathworks.com comp.soft-sys.matlab:526459


Hi guys,

let say I have vector  v=100x1, and a matrix M Nx2 with the beginning of Nth chunks in the first coulmn and the end of it in the second.
Is there a smart way to have a second vector v2 made of the chunks of vector v (i mean, without for loop)?

example
v=rand(100,1);
M=[1,4;7,8];

wished result

v2= v(1) v(2) v(3) v(4) v(7) v(8)

thanks in advance