Problems with splitting with readtable
13 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have a question regarding the readtable-function. I want to use this function to import a .csv-file into a table, but I'm having some problems with correclty splitting the data from this file. I added an example file of the file I want to import. The variable names of the table that I want to create, are in row 3 and the data are in row 4-6. By using the readtable function and specifying 'NumHeaderLines', I can correclty split the variable names. However, it does not correctly split the data, even when I'm using the 'Delimiter' option. All the data always ends up in the first column, but that is not how I want it. In the first data row ,the data from the variable 'Apparaat' should ABC DEF, from 'Serienummer' ABC123-ABC123-ABC123-ABC123-ABC123, from 'Tijdstempel apparaat' 24-07-2022 02:18, from 'Gegevenstype' 0, from 'Historische glucose mmol/l "6.0" and all the others columns should be empty. It does not matter that much what kind of datatypes are in the table, I can change them afterwards.
Does anyone know or has any tips how I can correctly split the data?
Thanks a lot!
1 件のコメント
Mathieu NOE
2023 年 12 月 11 日
seems the old csvimport is better handling your csv file
out = csvimport('Examplefile.csv');
out = 6×5 cell array
{'Patiëntrapport'} {'Gegenereerd op' } {'07-12-2023 13:29…'} {'Gegenereerd door'} {'Eleen Schupp' }
{'Examplefile' } {0×0 char } {0×0 char } {0×0 char } {0×0 char }
{'Apparaat' } {'Serienummer' } {'Tijdstempel appa…'} {'Gegevenstype' } {'Historische gluc…'}
{'"ABC DEF' } {'ABC123-ABC123-AB…'} {'24-07-2022 02:18' } {'0' } {'""6' }
{'"DEF GHI' } {'ABC123-ABC123-AB…'} {'24-07-2022 02:33' } {'0' } {'""7' }
{'"GHI ' } {'ABC123-ABC123-AB…'} {'24-07-2022 02:48' } {'0' } {'""8' }
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!