readtable working differently for different files
4 views (last 30 days)
Show older comments
Commented: Louise Wilson on 8 Jun 2021
I have a bunch of spreadsheets which all have the same format. However, when I read them in, they appear differently...
folder=('H:\SoundTrap\Boats\Manual Vessel Detections');
For some reason, one of the files is read using a different delimeter? So the columns are incorrectly split. How can I rectify this? I have tried detect import options and 'Format' '%s%s%s' to no avail. Perhaps I am using these incorrectly though. The desired format is the one below:
Walter Roberson on 8 Jun 2021
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/645435/001_GoatIsland_5100_manualVesselDetections.csv', 'delimiter', ',');
T2 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/645440/009_GoatIsland_5100_manualVesselDetections.csv', 'delimiter', ',');
The files are different: the second one has an extra empty field, and that throws off MATLAB into thinking maybe the delimiter is underscore.
More Answers (0)
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!