MATLAB: Extract Data from text File

extractfiletext;

Hi, can some one give me an indication to how to get the 2nd & 3rd column from the data at the end of this text file. There will generally be different headers, but the data headings ('Data', 'Position' and 'Value') will always be present just before the numeric data I wish to extract and plot.
Thanks
Listing of Huygens PSF Cross Section Data
File : C:\zemax\test
Title: Q654645645tretertertertretrtret
Date : 07/02/2017
Configuration 1 of 3
Huygens PSF Cross Section X
0.5820 to 0.5820 µm at 0.0000 mm.
Data spacing is 0.290 µm.
Strehl ratio: 0.991
Pupil grid size: 64 by 64
Image grid size: 64 by 64
Center coordinates : 0.00000000E+00, 0.00000000E+00 Millimeters
Values are relative irradiance normalized to a peak of 1.0.
X Section, Center Row
Data Position Value
0 -9.28143 0.000865
1 -8.99138 0.001357
2 -8.70134 0.001554
3 -8.41129 0.001315
4 -8.12125 0.000745
5 -7.83120 0.000189
6 -7.54116 0.000080
7 -7.25111 0.000691
8 -6.96107 0.001924
9 -6.67102 0.003279
10 -6.38098 0.004047
11 -6.09094 0.003706
12 -5.80089 0.002314
13 -5.51085 0.000677
14 -5.22080 0.000122
15 -4.93076 0.001872
16 -4.64071 0.006265

Best Answer

fid = fopen('YourFile.txt', 'rt');
data_cell = textscan(fid, '%f%f%f', 'CommentStyle', {'File', 'Data Position Value'}, 'CollectData', 1);
fclose(fid);
data = data_cell{1};
Note: make sure you get the spacing right on the Data header. If it turns out to have variable spacing then I would have to re-think how to do it.