readtable function inserting NaN rows

clear
clc
datatest = readtable('TestData_readtable.csv','Headerlines',4,'ReadVariableNames',true);
'readtable' function is getting confused about the '3-0382' and inserting addtional rows into the imported table
I tried to use 'Range' but I cannot get it to work and this would be a solution.
The data sets I have do change in column count and poitision and therfore I would also be interested if there are any other ways of dealing with this pesky hyphon.
I have tried 'rmmissing' on individual columns but this creates problems in other areas of my code and doesn't deal witht he issue at the source.
I have attached an exampel data set.
I would apreciate any support on this!

 Accepted Answer

clear
clc
datatest = readtable('TestData_readtable.csv','Headerlines',4,'ReadVariableNames',true,'CommentStyle',{'-'});
As always in formalising the question sometime the answer emerges.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Release

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!