Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!59g2000hsb.googlegroups.com!not-for-mail
From: wapo <apostolos.georgakis@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Indexing question
Date: Mon, 19 May 2008 06:20:50 -0700 (PDT)
Organization: http://groups.google.com
Lines: 24
Message-ID: <498a582f-af7d-43a4-a398-7fa7163d54ef@59g2000hsb.googlegroups.com>
References: <g0rqj1$38u$1@fred.mathworks.com>
NNTP-Posting-Host: 194.237.142.13
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1211203251 8780 127.0.0.1 (19 May 2008 13:20:51 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 19 May 2008 13:20:51 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: 59g2000hsb.googlegroups.com; posting-host=194.237.142.13; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) 
Xref: news.mathworks.com comp.soft-sys.matlab:469239



On May 19, 2:08 pm, "E " <ehel...@hotmail.com> wrote:
> 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 ?

A(B(1)):A(C(1)) will give you the first line