distinct values for a matrix

I have a matrix of 10x10..i have to find distinct values,,please help..those distinct values must also be a in matrix form..

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 4 Jan. 2012

0 Stimmen

unique() can be used to find distinct values. With the three-output form of unique() you can create a vector of indices into the unique values.

3 Kommentare

kash
kash am 4 Jan. 2012
But walter how to get values in a matrix,i need for every column the distinct values and form a matrix
Walter Roberson
Walter Roberson am 4 Jan. 2012
The number of unique values could vary from column to column, so the results cannot be placed in to a numeric matrix.
arrayfun(@(IDX) unique(Matrix(:,IDX)), 1:size(Matrix,2), 'Uniform', 0)
kash
kash am 4 Jan. 2012
Thank u walter

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by