Hi All,
I have a tricky task of reading this huge csv file (1360×107037) . The example data is attached with this question and it just contains only few rows and columns. I tried importing it through the matlab function readtable.
What I did –
- I tried to get the opts throught detectImportOptions()
- As the delimiter is 'semi-colon', I assigned it to opts.Delimeter
- Then I used readtable(filename, opts)
- I got a table with 1360 rows and 107037 columns.
Problem –
- I am getting in every even row for cells that supposed to be a string or datestring NaN values but all numerical values are retained
- I tried to make the 7th line of the csv data as VariableNames but somehow I am getting Var1, Var2, …… etc are the VariableNames
Does anyone know how could I get rid of these NaN values and obtain the actual string if exists or just an empty string and make the 7th line of the CSV file as the VariableNames.
Update 1
I guess it is expecting a number at that point but instead it is receiving a String!
Update 2
I did this –
opts.VariableTypes(1, 1:end) = {'char'};
Now I am getting all the values but now all the numbers are casted to 'char'!
I dropped all th eampty columns;
table (:, all(ismissing(table))) =[];
I thought of saving the Table as .mat for later use but (my stupidity) it contains now all 'char' values and the file is really huge!
Any help is appreciated!
Thanks & Cheers,
Savan
Best Answer