How to import a csv file in matlab 2015b
1 view (last 30 days)
Show older comments
The file contains both numeric and text data.
3 Comments
Answers (1)
madhan ravi
on 21 Dec 2018
Edited: madhan ravi
on 21 Dec 2018
fid=fopen('AQI Data.csv');
f=textscan(fid,'%s','delimiter','\n');
fclose(fid);
celldisp(f)
7 Comments
Kirthi ga
on 22 Dec 2018
fid = fopen('C:\Users\402\Desktop\AQI Data.csv')
fid =
3
T = readtable('C:\Users\402\Desktop\AQI Data.csv')
Error using readtable (line 135)
Reading failed at line 118. All lines of a text file must have the same number of delimiters.
Line 118 has 9 delimiters, while preceding lines have 8
Image Analyst
on 22 Dec 2018
Edited: Image Analyst
on 22 Dec 2018
So are you going to fix your corrupt data manually, or do you want to write a MATLAB program to process each line one at a time and try to determine if there is a problem with each line? Then, if there is a problem with a line, like 118, what do you want to do? Just skip it? Or warn the user and give them what they have so far, or throw an error and return nothing? Please answer.
See Also
Categories
Find more on Text Files 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!