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:
eliminate same results

Subject: eliminate same results

From: Tarik

Date: 13 May, 2013 20:17:09

Message: 1 of 3

Hi

how can I eliminate the same results such as

     0 0 3
     0 3 0
     3 0 0

     1 2 2
     2 1 2
     2 2 1

     1 2 2
     2 1 2
     2 2 1

     0 0 3
     0 3 0
     3 0 0

those are my results and every row repeated two times because of for loop;

I've already used---> unique(sthg,'rows')

I mean... for example "for loop" give same result l=0 and l=3

Subject: eliminate same results

From: Steven_Lord

Date: 13 May, 2013 20:36:01

Message: 2 of 3



"Tarik " <tarikak@gmail.com> wrote in message
news:kmrho5$4ro$1@newscl01ah.mathworks.com...
> Hi
>
> how can I eliminate the same results such as
>
> 0 0 3
> 0 3 0
> 3 0 0
>
> 1 2 2
> 2 1 2
> 2 2 1
>
> 1 2 2
> 2 1 2
> 2 2 1
>
> 0 0 3
> 0 3 0
> 3 0 0
>
> those are my results and every row repeated two times because of for loop;

So the ordering of the elements in each row doesn't matter?

SORT along the rows using the dimension input, then call UNIQUE with the
'rows' flag on the sorted input.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: eliminate same results

From: Tarik

Date: 13 May, 2013 20:54:08

Message: 3 of 3

hi
order is important...

"Tarik " <tarikak@gmail.com> wrote in message <kmrho5$4ro$1@newscl01ah.mathworks.com>...
> Hi
>
> how can I eliminate the same results such as
>
> 0 0 3
> 0 3 0
> 3 0 0
>
> 1 2 2
> 2 1 2
> 2 2 1
>
> 1 2 2
> 2 1 2
> 2 2 1
>
> 0 0 3
> 0 3 0
> 3 0 0
>
> those are my results and every row repeated two times because of for loop;
>
> I've already used---> unique(sthg,'rows')
>
> I mean... for example "for loop" give same result l=0 and l=3

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