Thread Subject: Indexing question

Subject: Indexing question

From: E

Date: 19 May, 2008 12:08:01

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: wapo

Date: 19 May, 2008 13:20:50

Message: 2 of 2

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

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:10:05
rssFeed for this Thread

Contact us at files@mathworks.com