MATLAB: Skipping the lines in a .txt file before importing it

importing excel datamatrix manipulationtext file

I am writing a code for manipulating the data in a .txt file and there are some lines before and after the file that i need to cut out since they are inconsequential. I am just in the beginning phases of this problem and i am just improvising as of now. My end goal is to be able to extract the calculated reaction times(ideally, in an excel file) and nothing else, not the raw reaction times. Here is what i have come up with. I thought i would start coding with some basics and see how that could be improved upon . Here is what i have down so far. This is very rudimentary so please feel free to advise/criticize the code.Any help would be greatly appreciated.
[filename] = uigetfile('*', 'Select the data file')
fid = fopen(filename,'r')
scan_init = cell2mat(textscan(fid, 'f %f %f %f', 'headerlines',19))
fclose(fid)
I am attaching the file in question alongside it.

Best Answer

Using headerlines is fine.
You missed a '%' at the beginning of your format.
You could use 'CollectOutput', 1 to avoid having to do the cell2mat:
scan_init_cell = textscan(fid, '%f %f %f %f', 'headerlines', 19, 'CollectOutput', 1);
scan_init = scan_init_cell{1};