Updated to MATLAB 2019a and having an issue with the read table function for .csv
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Benjamin Ye
le 13 Juin 2019
Modifié(e) : Benjamin Ye
le 13 Juin 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 commentaires
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!