MATLAB: Hello, can any one help me out? I have an mxn matrix with repeated columns. How to get another matrix from this very one which is having no repetition of columns. Many thanks for anticipated assistance.

matrix with unique columns

For example, A=[2 3 4 4 3; 1 2 4 4 2; 2 4 6 6 4]. I wish to have a unique matrix B from A: That is B=[2 3 4; 1 2 4; 2 4 6] having unique columns.

Best Answer

Transpose your matrix, use unique with the rows option, and then transpose again:
A=[2 3 4 4 3; 1 2 4 4 2; 2 4 6 6 4]
B = unique(A.', 'rows','stable').'