MATLAB: Numbering characters of a protein

numbering

Hello
I'm trying to use MATLAB to biuld a script the will take a long word of text (array) 'FFAMSGPRPGAERLAVPGPDGGGGTGPWWAAGGRG'
and give me an index to each character on it's own. also to put only 20 characters in each line
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
F F A M S G P R P G A E R L A V P G P D
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
G G G G T G P W W A A G G R G

Best Answer

  • S = 'FFAMSGPRPGAERLAVPGPDGGGGTGPWWAAGGRG';
    for K = 1 : 20 : length(S)
    L = min(length(S), K+19);
    fprintf('%2d ', K:L);
    fprintf('\n');
    fprintf(' %c ', S(K:L));
    fprintf('\n\n');
    end