Updated to MATLAB 2019a and having an issue with the read table function for .csv
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I recently updated to MATLAB 2019a and I am having an issue with the readtable function. Prior to this I had MATLAB 2018a, and the function worked fine. Here is my code:
t = readtable(tempfilename);
Where tempfilename is a .csv file. This is the error I keep getting:
Error using readtable (line 216)
Expected a cell array of valid variable names.
Note: readtable detected the following parameters:
'Delimiter', ',', 'HeaderLines', , 'ReadVariableNames', true, 'Format', ''
I'm not sure what about the update caused this error to start or how to fix it.
0 Commenti
Risposte (1)
Benjamin Ye
il 13 Giu 2019
Modificato: Benjamin Ye
il 13 Giu 2019
Looks like MATLAB now checks whether the imported header names are less than 63 characters, which is the limit for variable names. Not sure why they consider header names to be variable names, since they're stored in cells. So if your header names are longer than that, readtable() no longer works. I have the same issue and have reverted back to 2018b.
Alternatively, and this is not recommended since I'm not sure if it breaks anything else, you could remove the check ~all(cellfun(@isvarname,rhs) in line 165 in ImportOptions.m. I was able to get my old script with the readtable() function to work.
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!