count the number of unique elements
Afficher commentaires plus anciens
I have a matrix with 2 rows 23 columns
M = [3,2,3,3,2,3,3,2,4,3,3,3,1,1,1,3,4,4,3,5,5,3,3;1,1,1,1,1,1,1,1,1,2,2,2,3,3,4,4,4,4,5,5,6,6,6];
Now i'll take all columns where column = 1 in row2
3 2 3 3 2 3 3 2 4
1 1 1 1 1 1 1 1 1
and i need to count the number of unique elements in so much columns, and also convert into its percentage
1 = 0
2 = 3
3 = 5
4 = 1
5 = 0
percentage computation
0/9 *100
3/9 *100
5/9 *100
1/9 *100
0/9 *100
% where 9 is the number of columns with column value 1 in row2
then take all columns where column = 2 in row2
3 3 3
2 2 2
then take all columns where column = 3 in row2 and upto 6
Row1 has unique values 1 to 5, and
Row2 has unique values 1 to 6
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!