calculating percentage for row values
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Wayne King
2012년 8월 18일
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
Jan
2012년 8월 28일
~cellfun('isempty', C) is more efficient than ~cellfun(@isempty, C). But with anonymous functions, cellfun is even slower.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!