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:
Matrix- Remove repeated co-ordinate

Subject: Matrix- Remove repeated co-ordinate

From: GAURAV

Date: 4 Nov, 2010 00:59:04

Message: 1 of 5

Hi!

Say I have an array A=[1 2; 3 4; 1 2; 3 8; 2 5; 1 2].
Now, I have to remove the repeated element and have it occur only once.
Here, [1 2] is repeated thrice but in final answer it has to come once.
How to do this?
Need final answer A=[1 2; 3 4; 3 8; 2 5].

Thank You,
Regards,
Gaurav

Subject: Matrix- Remove repeated co-ordinate

From: Steven_Lord

Date: 4 Nov, 2010 01:41:56

Message: 2 of 5



"GAURAV " <gsharda@engineering.uiowa.edu> wrote in message
news:iat0go$6im$1@fred.mathworks.com...
> Hi!
>
> Say I have an array A=[1 2; 3 4; 1 2; 3 8; 2 5; 1 2]. Now, I have to
> remove the repeated element and have it occur only once. Here, [1 2] is
> repeated thrice but in final answer it has to come once.
> How to do this?

HELP UNIQUE.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Matrix- Remove repeated co-ordinate

From: GAURAV

Date: 4 Nov, 2010 02:26:04

Message: 3 of 5

"Steven_Lord" <slord@mathworks.com> wrote in message <iat314$g4s$1@fred.mathworks.com>...
>
>
> "GAURAV " <gsharda@engineering.uiowa.edu> wrote in message
> news:iat0go$6im$1@fred.mathworks.com...
> > Hi!
> >
> > Say I have an array A=[1 2; 3 4; 1 2; 3 8; 2 5; 1 2]. Now, I have to
> > remove the repeated element and have it occur only once. Here, [1 2] is
> > repeated thrice but in final answer it has to come once.
> > How to do this?
>
> HELP UNIQUE.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


Hi Steven!

Thanks for your reply. One doubt. I need to get both the co-ordinates in matrices.

Say,A=[1 2; 3 4; 1 2];
I need to get output=[1 2; 3 4] i.e. a 2*2 matrix.

From unique we get a n*1 matrix and here in this case o/p is
1
2
3
4
but how to get the result
1 2
3 4

?

Thanks,
Gaurav

Subject: Matrix- Remove repeated co-ordinate

From: Bruno Luong

Date: 4 Nov, 2010 06:22:03

Message: 4 of 5


> Hi Steven!
>
> Thanks for your reply. One doubt. I need to get both the co-ordinates in matrices.
>
> Say,A=[1 2; 3 4; 1 2];
> I need to get output=[1 2; 3 4] i.e. a 2*2 matrix.
>
> From unique we get a n*1 matrix and here in this case o/p is

Use UNIQUE with ROWS option.

Bruno

Subject: Matrix- Remove repeated co-ordinate

From: GAURAV

Date: 4 Nov, 2010 06:38:04

Message: 5 of 5

"GAURAV " <gsharda@engineering.uiowa.edu> wrote in message <iat5js$163$1@fred.mathworks.com>...
> "Steven_Lord" <slord@mathworks.com> wrote in message <iat314$g4s$1@fred.mathworks.com>...
> >
> >
> > "GAURAV " <gsharda@engineering.uiowa.edu> wrote in message
> > news:iat0go$6im$1@fred.mathworks.com...
> > > Hi!
> > >
> > > Say I have an array A=[1 2; 3 4; 1 2; 3 8; 2 5; 1 2]. Now, I have to
> > > remove the repeated element and have it occur only once. Here, [1 2] is
> > > repeated thrice but in final answer it has to come once.
> > > How to do this?
> >
> > HELP UNIQUE.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
>
>
> Hi Steven!
>
> Thanks for your reply. One doubt. I need to get both the co-ordinates in matrices.
>
> Say,A=[1 2; 3 4; 1 2];
> I need to get output=[1 2; 3 4] i.e. a 2*2 matrix.
>
> From unique we get a n*1 matrix and here in this case o/p is
> 1
> 2
> 3
> 4
> but how to get the result
> 1 2
> 3 4
>
> ?
>
> Thanks,
> Gaurav

Hi!
Thanks a lot! :)
Gaurav

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