removing equal elements from a matrix

1 view (last 30 days)
Hi all,
I have a matrix like "a" whose some elemnts are equal to each other. I wato to transform this matrix to a vector like "b" with non-equal elements.
e.g. a=[ 1 2 3 ; 3 4 5; 6 4 7]; >> b=[1 2 3 4 5 6 7];
How can I write this program? Thanks in advance.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 26 Feb 2013
Edited: Azzi Abdelmalek on 26 Feb 2013
a=[ 1 2 3 ; 3 4 5; 6 4 7];
b=unique(a(:))'

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!