finding the number of occurences

1 vue (au cours des 30 derniers jours)
Pat
Pat le 3 Sep 2012
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 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 3 Sep 2012
Modifié(e) : Azzi Abdelmalek le 3 Sep 2012
can you explain how occurrence is equal to 3 in this case. do you mean it's the columns number?

Connectez-vous pour commenter.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 3 Sep 2012
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

Plus de réponses (0)

Catégories

En savoir plus sur Genomics and Next Generation Sequencing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by