finding the number of occurences

조회 수: 2 (최근 30일)
Pat
Pat 2012년 9월 3일
I have values as
gene =
{6x5 cell}
{6x5 cell}
{5x4 cell}
{4x5 cell}
{3x5 cell}
{2x4 cell}
It consists of values as
gene{1,1}
'Genes' 'T0&T2' 'T2&T4' 'T4&T6' 'perc'
'YAR029W' 'd' 'd' 'd' 60
'YAR062W' 'du' 'ud' 'du' 60
'YBL095W' 'du' 'ud' 'du' 60
'YBR074W' 'du' 'ud' 'du' 60
'YBR138C' 'du' 'ud' 'du' 60
'YBR285W' 'du' 'ud' 'du' 60
I need as
'Genes' 'T0&T2' '' 'perc'
'YAR029W' 'd' '' 60
'YAR062W' 'du' 3 60
'YBL095W' 'du' 3 60
'YBR074W' 'du' 3 60
'YBR138C' 'du' 3 60
'YBR285W' 'du' 3 60
3 is the number of occurences it varies for other genes,please help
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2012년 9월 3일
편집: Azzi Abdelmalek 2012년 9월 3일
can you explain how occurrence is equal to 3 in this case. do you mean it's the columns number?

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 9월 3일
r = cell(size(gene))
for jj = 1:numel(r)
r{jj}(:,[1:2,4]) = gene{jj}(:,[1:2,end]);
r{jj}(:,3) = [repmat({''},2,1);repmat({3},size(r{jj},1)-2,1)];
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genomics and Next Generation Sequencing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by