Thread Subject: Indexing question

Subject: Indexing question

From: E

Date: 19 May, 2008 12:01:02

Message: 1 of 2

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 ?

Subject: Indexing question

From: Matt

Date: 21 May, 2008 20:31:01

Message: 2 of 2

"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))

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
indexing E 19 May, 2008 08:05:05
rssFeed for this Thread

Contact us at files@mathworks.com