MATLAB: Skipping lines in text file

loading text fileskipping linestext file

Hello, I have a text file called Acc that has two columns of data. The first has text and i want it to skipped. Can anyone help me solve it. I am a new user.
Here is how I load the data;
load 'Acc.txt';
time = Acc(:,1);
Acc_x = Acc(:,2);
Thank you
Muhsin

Best Answer

Most likely, you could read the file very simply with:
t = readtable('Acc.txt');
which, if the first line is a header, should parse the header correctly and name the columns correctly. if that doesn't work you can always tell readtable to skip the first line:
t = readtable('Acc.txt', 'HeaderLines', 1);
Note that reading a file as a table is much better than popping variables with unpredictable names in your workspace.