MATLAB: Readtable() inserting NaN’s in good data

MATLABnanreadtable

I have a CSV file containing a sine wave. One value per line. For some reason MatLab is inserting NaN's everywhere, even though examing the file by hand or importing into Excel shows no bad data exists. There are 6,000 entries, but Matlab adds over 1,000 NaN's. I intend to add more columns, so readtable() should work. What am I doing wrong?
Please see the attached CSV. Observe how plotting it produces gaps due to the NaN's.
tab = readtable("output.csv");
plot(tab.Var1)

Best Answer

it's not really a table - it's just a single column of numbers. Use csvread() instead of readtable and it works fine:
data = csvread('output.csv')
plot(data, 'LineWidth', 2)
grid on;
0000 Screenshot.png