MATLAB: Reading/writing text file while excluding header

headertext file

I'm new-ish to MATLAB, and until now I've only used it to perform Matrix Displacement Method analyses for structures classes.
I have large earthquake record files that I would like to read in. They have headers (4 lines) that I would like to omit, and 5 columns of acceleration data (the number of rows depends on the size of the earthquake record). Is there a way to read in this data and then write the array to a new text file? I've spent hours pouring over past forum topics, and I haven't had any luck with my attempts.
The closest I've come is to use importdata(), but the 'data' array returns dimensions that don't seem right (that, and I don't know how to access the elements of a structured array like 'data').
Hints would be much, much appreciated!

Best Answer

FID=fopen('test_quake.txt');
datacell = textscan(FID, '%f%f%f%f%f', 'HeaderLines', 4, 'CollectOutput', 1);
fclose(FID);
A = datacell{1};
Related Question