Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
skip every other number

Subject: skip every other number

From: ravi

Date: 5 Apr, 2010 09:11:04

Message: 1 of 2

Hi ,

 I have a vector:

A = [ 2 5 8 9 7 6]

Using A, how can I get

B = [ 2 8 7 ]

and

C = [ 5 9 6 ]

Thanks
Ravi

Subject: skip every other number

From: Wayne King

Date: 5 Apr, 2010 10:17:04

Message: 2 of 2

"ravi " <ravi_071@hotmail.com> wrote in message <hpc9f8$7ej$1@fred.mathworks.com>...
> Hi ,
>
> I have a vector:
>
> A = [ 2 5 8 9 7 6]
>
> Using A, how can I get
>
> B = [ 2 8 7 ]
>
> and
>
> C = [ 5 9 6 ]
>
> Thanks
> Ravi

Hi Ravi,

A(1:2:end)
A(2:2:end)

You should spend some time reading the MATLAB Getting Started Guide. This elementary operations are covered very well.

Wayne

Tags for this Thread

No tags are associated with this thread.

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.

Contact us