Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Indexing question
Date: Mon, 19 May 2008 12:01:02 +0000 (UTC)
Organization: ASML Netherlands B.V.
Lines: 21
Message-ID: <g0rq5u$svu$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1211198462 29694 172.30.248.37 (19 May 2008 12:01:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 19 May 2008 12:01:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 850848
Xref: news.mathworks.com comp.soft-sys.matlab:469218



Hi all,

I would like to know a quick/efficient way to do the following.

Suppose I have a vector 

  A=[10 20 30 40 50 60 70 80 90 100]

And I want also have two other vectors eg 

  B = [1 5 9] 
  C = [3 7 10] 

Now combine B and C to make indexing for A
B C
1:3  ==>  10:20 (10,11,12,..30)
5:7  ==>  50:60 (50,51,52...70)
9:10 ==> 90:100 (90,91,92..100)
etc

Any ideas ?