Hello,
I want to read about 14 million rows of data from an .csv file an save it in a cell array.
The .csv file looks like this:
vehicle_id;_date;measurement_start;measurement_end100454;2016-09-11T15:01:14.769Z;2.620;6.400100454;2016-09-11T15:01:15.769Z;7.820;10.400100452;2016-09-11T15:01:16.769Z;3.620;9.400100453;2016-09-11T15:01:17.769Z;4.620;5.400100454;2016-09-11T15:01:18.769Z;20.620;25.400100458;2016-09-11T15:01:19.769Z;8.620;16.400100454;2016-09-11T15:01:20.769Z;45.620;50.400
This is my Script to create the cell Array:
clear;[filename, pathname] = uigetfile({'*.csv','All Files (*.*)'}, 'Pick a file');filename = [pathname filename];delimiter = ';';startRow = 2;formatSpec = '%f %{yyyy-mm-ddTHH:MM:SSZ}D %f %f %*{^\n}';fileID = fopen(filename,'r');dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1, 'ReturnOnError', false);fclose(fileID);
The mistake is in formatSpec when I try to format the Date and Time.
It's one easy mistake, but I can't figure it out.
Best Answer