i have some problem in this code. upto subsample{i} it works fine. i done some certain operation on every elements of subsample. but i cant able to store these values into kmers{x}.it will be batter if values are store in a matrix. please help me .

3 visualizaciones (últimos 30 días)
i have some problem in this code. upto subsample{i} it works fine. i done some certain operation on every elements of subsample. but i cant able to store these values into kmers{x}.it will be batter if values are store in a matrix. please help me.
sample=datasample('ATCG',20);
display(sample);
i=1;
for k= 1:length(sample)
subsamplelength = randi([5 10]);
subsamplestart = randi(length(sample)-subsamplelength+1);
subsample{i}= sample(subsamplestart : subsamplestart+subsamplelength-1);
i=i+1;
end
display(subsample);
for r=1:length(subsample)
element=subsample{r};
ksize=5;
x=1;
for j= 1:length(element)-ksize+1
kmers{x} = element(j:j+ksize-1) ;
disp(kmers);
end
x=x+1;
end
  6 comentarios
per isakson
per isakson el 19 de Mayo de 2015
"if i use this x=x+1; or not i got the same result" &nbsp Use in what way?
Tonmoy saha
Tonmoy saha el 19 de Mayo de 2015
if i use x=x+1 inside the inner loop i got this kind of result
'GCCAC'
'TAACG'
'TAACG' 'AACGC'
'TAACG' 'AACGC' 'ACGCT'
'TAACG' 'AACGC' 'ACGCT' 'CGCTG'
'TAACG' 'AACGC' 'ACGCT' 'CGCTG' 'GCTGC'
'GCCAC' 'AACGC' 'ACGCT' 'CGCTG' 'GCTGC'
'GCCAC' 'CCACC' 'ACGCT' 'CGCTG' 'GCTGC'
.........
if i use x=x+1 outside the loop or not it gives me same expected result but not in char array form. in my next phase i can't able to access the kmers{x} values.
display(kmers{2});
Index exceeds matrix dimensions.
values are not storing into kmers{x}. this is my problem.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by