MATLAB: How to skip the first 3 lines and read two columns of numerical data as a matrix

read datatext filetextscan

Dear friends, Enclosed please find a text file. I want to skip the first 3 lines and read the remaining numerical data in 2 columns as a matrix. Many thanks in advance

Best Answer

Use textscan:
fidi = fopen('rp_test.txt', 'rt');
d = textscan(fidi, '%f %f', 'HeaderLines',2);
figure(1)
plot(d{1}, d{2})
xlabel('"Flow Time"')
ylabel('"Area-Weighted Average Pressure Coefficient"')
grid