Grouping variables from char.
Mostra commenti meno recenti
I have a code where I generate random letter-sequences (randseq(20)) in DNA and output number of occurrences from a function. I want to group them so that all occurrences where the two first letters are equal is added together. I collect all outputs in a cell array:
5×2 cell array
C =
'GA' [ 0]
'AA' [ 0]
'CC' [ 2]
'CC' [ 2]
'AT' [42]
I want to group them such that all occurrences of e.g CC is in one group, in order to plot it in a bar chart.
Hope anyone can help me! Best regards
Risposte (1)
Star Strider
il 2 Dic 2017
0 voti
If you put your data in a categorical array (see the documentation on Categorical Arrays (link)), you can use the countcats (link) function.
1 Commento
Andy
il 2 Dic 2017
Categorie
Scopri di più su Discrete Data Plots in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!