removing equal elements from a matrix

1 Ansicht (letzte 30 Tage)
som
som am 26 Feb. 2013
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.

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by