Could someone help me import data from a .csv file?
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Data Import and Export 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!