I want to break my sample like this. Problem with my logic. need help
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tonmoy saha
am 4 Mär. 2015
Kommentiert: Jos (10584)
am 7 Mär. 2015
suppose my sample is GAATGCT. i take a size say 4. my output will be like this GAAT,AATG,ATGC,TGCT. when it reach the last position it will stop. it tried for loop but instead of getting this kind of output it gives me single char. i think there is a problem with my logic. can anyone help me. subsample='GAATGCT'; for n=subsample(1:(end-4+1)) for i=subsample(1:4) display(i) end end
3 Kommentare
Akzeptierte Antwort
Jos (10584)
am 4 Mär. 2015
data = 'GAATGCT'
N = 4 ;
for k= 1:numel(data)-N
subsample = data(k:k+N) ;
disp(subsample)
end
5 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!