MATLAB: Extract a specific line in text files

specific line in many text files

how are you best community :
I have about 6000 text files each of them has 11 lines as shown next :
COM: IFN/ENIT-database truth (label) file
COM: http://www.ifnenit.com
COM: IfN, TU-BS
COM: ae07_001.tif coming from pa021_0.tif
X_Y: 449 119
BDR: begin data record
LBL: ZIP:1251;AW1:ÇáÔÑÇíÚ;AW2:aaA|laB|shM|raE|aaA|yaB|ayE|;QUA:YB2;ADD:P4
CHA: 7
BLN: 82,78
TLN: 32,62
EDR: end of data record
i want to extract from the seventh line only the text
"aaA|laB|shM|raE|aaA|yaB|ayE|"
( the part i want to extract does not has the same size from file to file )and put all of them in a new array with same size of files numbers .
how can i do it
any answer will be appreciated .
thank you

Best Answer

Use fileread() to read the file into a single string. Use regexp() to match the portions of it you want. For example
regexp(TheString, '(?<=COM:\s+)\S+(?=\s+coming)', 'match')