Could someone help me import data from a .csv file?

1 visualización (últimos 30 días)
Lennaert
Lennaert el 3 de Oct. de 2012
I am having difficulties importing data from a csv file. Below you can find a copy of the first three lines. The first, a headerline and the second two are just the data. I have tried csv read and text read but seem to be running into problems. Could someone please tell me how to do it properly and explain why?
Kind regards,
Lennaert
file: 'summary.csv'
LINE 1:
DateTime,IR Temp,ECG Qual,Belt Qual,EDR Qual,Imp Qual,PWI Conf,ECG HR,EDR BR,Belt BR,Imp BR,HR consist,BR consist,Core Serial,Core Temp,Patch Serial,Patch Temp,Vbat,Body Pos,Motion,Nonin SpO2,Nonin HR,Thermistor Ambient,Ambient IR,Thermistor Skin
LINE 2:
19/09/2012 16:39:48.266,26,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Upright,MovingFast,-1,-1,-1,23.5,-1,
LINE 3:
19/09/2012 16:39:53.266,26,-1,-1,-1,-1,-1,307.2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Side,MovingSlowly,-1,-1,-1,23.5,-1,
NOTE FIRST Column of data looks like: dd/mm/yyy hh:mm:ss:ms

Respuesta aceptada

owr
owr el 3 de Oct. de 2012
If you have the Statistics Toolbox,try:
ds = dataset('File','summary.csv','Delimiter',',');
The fact that you have mixed types in your columns (numeric and text) makes dataset arrays the ideal container for your data.

Más respuestas (0)

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by