I have a file .txt which contains the following text:
VT970103 KOR T. 5 P P2 P2
CTC N VT980023 GRA T. 6
VT943333 MAI A. 7 P1 P2 P2
JC1 VT910209 MER T. 8 P U2 P
CTC VT965366 KIR M. 9 P2
RH856957 DIOP C. 10 P2 P2 P P
VT860609 KOR M. (CAP) 11 P P P P1
JC1 VT940239 BER R. 12 P2
JC1 OH883091 FAL M. 14 P2 P2 T1
VT900521 JEN T. 15 P P P2 T1
VT740910 JAC J.TC
I would like to extract three datas of each line. For example for the first line: 'VT970103' , 'KOR T' and '5'.
I use the following function textscan:
fid = fopen( 'text.txt', 'r' );
lic = textscan(fid, '%s %[ABCDEFGHIJKLMNOPQRSTUVWXYZ ] %[^1234567890] %d %*[^\n]')
It works when the line has the same format as the first line. But I would like to skip the second line for example because there is not any interesting information. For the third line I would like to skip 'CTC N', and begin to read at VT, and so on.
The common feature to begin to read a line would be when you have a string which contains 2 letters and 6 figures one after the other without any whitespace.
I hope my description is enough clear.
Thank you for your help.