MATLAB: How i will make function or code for creating pair of 3 element form this string={A, R ,N ,D,C,E,Q,G​,H,I,L,K,M​,F,P,S,T,W​,Y,V}.

amino acidbioinformatictripeptide

i want to make function of Tripeptide composition for 20 basic amino acid{'A', 'R' ,'N' ,'D','C','E','Q','G','H','I','L','K','M','F','P','S','T','W','Y','V'} that give me such out put. 'AAA','RAA','NAA','DAA','CAA','EAA', 'QAA',GAA','HAA','IAA','LAA','KAA', 'MAA','FAA','PAA','SAA','TAA','WAA', YAA','VAA','ARA','RRA','NRA','DRA', CRA','ERA','QRA','GRA','HRA','IRA', LRA','KRA','MRA','FRA','PRA','SRA', ……} i will get 8000 pairs

Best Answer

>> V = 'ARNDCEQGHILKMFPSTWYV';
>> [X,Y,Z] = ndgrid(1:numel(V));
>> P = V([X(:),Y(:),Z(:)]);
>> size(P)
ans =
8000 3
>> P(1:30,:) % take a look at the first thirty rows.
ans =
AAA
RAA
NAA
DAA
CAA
EAA
QAA
GAA
HAA
IAA
LAA
KAA
MAA
FAA
PAA
SAA
TAA
WAA
YAA
VAA
ARA
RRA
NRA
DRA
CRA
ERA
QRA
GRA
HRA
IRA
If you really want to, you can split each row into the cell of cell array:
C = num2cell(P,2);
or
C = cellstr(P)