Importing via csvread and having dates in 'm/d/yyyy h:mm' format.
Show older comments
Hello, I'm importing some data files via csvread. I want to use csvread since I can specify to skip the first ~4 rows which just contain strings (header information). Unfortunately, all the dates are in the custom excel format m/d/yyyy h:mm which looks like this:
11/15/2012 11:05
In excel's general format this converts to 41228.46227 which is perfect for my analysis purposes since I need to break down the data by date and time. Manually converting it to the general format has been my work around, but isn't acceptable for the final script I want to write.
I suppose what I want to do is read in the date/time as a string and then perform the conversion in matlab.
The full error text I receive is:
"
Error using dlmread (line 139) Mismatch between file and format string. Trouble reading number from file (row 1u, field 2u) ==> /15/2012 11:05,0,0\n
Error in csvread (line 48) m=dlmread(filename, ',', r, c);
Error in testing (line 5) raw_data = csvread('FSA00147_Main_Cleaned.csv');
"
I'm not sure what's going on here, something about the date is throwing dlmread.
Any help is greatly appreicated! If you can suggest and alternate way to read in these .csv files, that would work too!
Accepted Answer
More Answers (0)
Categories
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!