Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Indexing question
Date: Wed, 21 May 2008 20:31:01 +0000 (UTC)
Organization: National Geospatial Intelligence Agency
Lines: 32
Message-ID: <g120q5$skh$1@fred.mathworks.com>
References: <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 1211401861 29329 172.30.248.37 (21 May 2008 20:31:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 21 May 2008 20:31:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 690188
Xref: news.mathworks.com comp.soft-sys.matlab:469742



"E " <ehelden@hotmail.com> wrote in message 
<g0rq5u$svu$1@fred.mathworks.com>...
> 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 ?



set1 = A(B(1)):A(C(1))