MATLAB 2018a readtable VariableNamesLine bug
- If ReadVariableNames is true, then read the variable names from the specified file by using the VariableNamesRange or the VariableNamesLine property of the import options object.
- If ReadVariableNames is false, then read the variable names from the VariableNames property of the import options object."
3 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
2 Kommentare
For me, the T = readtable(fullFileName, opts, 'ReadVariableNames', true) did not work
And setting a particular variable name is not helpful as the column order is not fixed.
This however ...
opts= detectImportOptions(filename,'Delimiter', ";", 'VariableNamesLine', 2,'VariableUnitsLine' ,3);
... allowed me to set the options and correctly read the names. It is unfortunate there are so many such inconsitencies in the Matlab language. Names and types of variables appear to be required, but there is no convenient way to read them outside of detectImportOptions. Using the import tool and the script generator will result in a fixed string for variable names, so clearly they know it doesn't work as it should.
2 Kommentare
Siehe auch
Kategorien
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!