MATLAB: How ignore heaerlines and import only the data

data importhelp

I have a txt file with a header and data to follow. I can't figure out how to import the data can get all the values from the first column into a variable called "x" and the data from the second column into a variable called "y". I've been experimenting with dlmread and import data but can't figure it out. I have attached the txt file that contains the data.

Best Answer

I would use textscan (link):

fidi = fopen('1_Linear.txt', 'rt');
Dc = textscan(fidi, '%f %f', 'HeaderLines',10, 'CollectOutput',1);  % Cell Array
Dn = [Dc{:}];                                                       % Numeric Array