MATLAB Answers

How to delete repeated column in this matrix?

26 views (last 30 days)
Arul prasath
Arul prasath on 30 Jan 2015
Edited: Arul prasath on 30 Jan 2015
a= [6.7747 15.1502 126.0000
67.9227 33.3699 74.0000
54.9636 40.7709 74.0000
102.5013 144.4162 44.0000
67.9227 33.3699 74.0000
54.9636 40.7709 74.0000];
i should not get the repeated values and i should get like this.
b=[6.7747 15.1502 126.0000
67.9227 33.3699 74.0000
54.9636 40.7709 74.0000
102.5013 144.4162 44.0000];
  4 Comments
Arul prasath
Arul prasath on 30 Jan 2015
ya that's right it's not a matrix it's a value that's consist three variables like this
'x' y z
[67.9227 33.3699 74.0000];
but i'm considering only rows not columns in above my example.

Sign in to comment.

Accepted Answer

Niels
Niels on 30 Jan 2015
b = unique(a,'rows','stable');
b =
6.7747 15.1502 126
67.9227 33.3699 74
54.9636 40.7709 74
102.5013 144.4162 44
That should do it.
  8 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!