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

조회 수: 1 (최근 30일)
Lennaert
Lennaert 2012년 10월 3일
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

채택된 답변

owr
owr 2012년 10월 3일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by