calculating percentage for row values
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
final =
'Genes' 'T0&T2' 'T1&T3' 'T2&T4' 'T3&T5' 'T4&t6'
'YAR029W' 'd' [] 'd' [] 'd'
'YBL095W' 'd' [] [] 'd' 'd'
'YBL111C' 'u' 'u' 'u' 'u' []
'YBL113C' 'u' 'u' 'u' 'u' 'u'
'YBR096W' 'u' 'u' 'u' 'u' []
'YBR138C' 'd' [] [] 'd' 'd'
I have a above matrix in which i want to calculate the percentage for every gene
for example 'YAR029W' has 3 values so percentage is 60%(3/5*100)
'YBL095W'- 60%
'YBL111C' -80%
YBL113C' -100%
i need to perform for all genes,please help
0 Commenti
Risposta accettata
Wayne King
il 18 Ago 2012
One thing you can do
emptycells = cell2mat(cellfun(@(x) ~isempty(x),final,'uni',0));
perempty = sum(emptycells(2:end,2:end),2);
perempty = (perempty./5)*100;
1 Commento
Jan
il 28 Ago 2012
~cellfun('isempty', C) is more efficient than ~cellfun(@isempty, C). But with anonymous functions, cellfun is even slower.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Cell Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!