CSV reader supporting strings
This function reads the data contain in a .csv file and transform it for its use. The function returns the next values:
data: contains the readed data. The columns that contains nominal values are transformed into numerical ones.
column_names: if the file contains a header, this variable saves the name of each column(*).
string_conversions: this variable contains the nominal values of the columns that have been transformed. If the column has numerical value, it contains {}. Otherwise, the nominal values are saved in column position.
(*)NOTE: In case of a entire nominal dataset with no header, the first example can be confused with header.
Example: the file contains the following data:
A,B,C,D
1,2,Sun,YES
3,1,Rain,YES
3,5,Sun,NO
Then, the function returns:
- data = [ 1 2 2 2
3 1 1 2
3 5 2 1]
- column_names = {'A','B','C', 'D'}
- string_conversions = {{}
{}
{'Rain' 'Sun'}
{'NO' 'YES'}}
Cita come
Pedro (2026). CSV reader supporting strings (https://it.mathworks.com/matlabcentral/fileexchange/48798-csv-reader-supporting-strings), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0.0 |
