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:
erase rows with NIL or one repeat of a digit

Subject: erase rows with NIL or one repeat of a digit

From: ravi

Date: 21 Oct, 2010 06:21:03

Message: 1 of 2

Hi folks,

I have a problem I'd like some help with please.

How can I only remain with the rows where at least 2 sets of values are repeated twice are kept, whilst those with no repeats , or , the case where only 1 value that repeats twice are deleted.

Currently , in my work , I'm dealing with the following matrix H:

H =
              1 1 4 4 5 7
              1 2 4 5 6 7
              2 4 5 5 6 6
              1 4 5 5 6 7

I would like to remain with:

H_output =
                          1 1 4 4 5 7
                          2 4 5 5 6 6



Lend me some help if possible guys.

cheers
ravi
            

Subject: erase rows with NIL or one repeat of a digit

From: Jos (10584)

Date: 21 Oct, 2010 13:15:06

Message: 2 of 2

"ravi " <ravi_071@hotmail.com> wrote in message <i9om4f$qhu$1@fred.mathworks.com>...
> Hi folks,
>
> I have a problem I'd like some help with please.
>
> How can I only remain with the rows where at least 2 sets of values are repeated twice are kept, whilst those with no repeats , or , the case where only 1 value that repeats twice are deleted.
>
> Currently , in my work , I'm dealing with the following matrix H:
>
> H =
> 1 1 4 4 5 7
> 1 2 4 5 6 7
> 2 4 5 5 6 6
> 1 4 5 5 6 7
>
> I would like to remain with:
>
> H_output =
> 1 1 4 4 5 7
> 2 4 5 5 6 6
>
>
>
> Lend me some help if possible guys.
>
> cheers
> ravi
>

What if a value is present three times of more? Does it count as 1 repetition?
Are the values in sorted order?

Perhaps this snippet helps you:

Result = H(sum(diff(H,1,2) == 0,2) < 2,:)

Jos

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