Got Questions? Get Answers.
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:
removing repetitive numbers from a vector.

Subject: removing repetitive numbers from a vector.

From: salamay

Date: 13 Oct, 2010 18:29:04

Message: 1 of 4

Hi,

If I have a vector r = [127 127 127 ...... 242 242 242 ..... 372 372 ...... 580 580 ....... 619 619 619 ..]

i would like to strip all the repetitions and get this

r = [127 242 372 580 619 ..]

then i would like to remove all the even numbered values and get this

r = [127 372 619 ..]

Subject: removing repetitive numbers from a vector.

From: salamay

Date: 13 Oct, 2010 18:49:04

Message: 2 of 4

can someone help me with this

Subject: removing repetitive numbers from a vector.

From: Sean

Date: 13 Oct, 2010 18:50:04

Message: 3 of 4

"salamay " <coldfusion99@gmail.com> wrote in message <i94tpg$jsl$1@fred.mathworks.com>...
> Hi,
>
> If I have a vector r = [127 127 127 ...... 242 242 242 ..... 372 372 ...... 580 580 ....... 619 619 619 ..]
>
> i would like to strip all the repetitions and get this
>
> r = [127 242 372 580 619 ..]
>
> then i would like to remove all the even numbered values and get this
>
> r = [127 372 619 ..]

help unique

B = unique(A);
B = B(1:2:end);

Subject: removing repetitive numbers from a vector.

From: salamay

Date: 14 Oct, 2010 17:21:05

Message: 4 of 4

Oh nice Its unique!
Thanks

Tags for 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