import data without header
8 次查看(过去 30 天)
显示 更早的评论
I need to import data from a .TXT file.
Skip header
Data in different variables (Ex: time, Ch1, Ch2 and Ch3)
I can't do it, does anyone have any examples?
DynoWare Version 2.6.3.12
Path: C:\Users\FT10R0\
Filename: FT10R0.dwd
Config ID: FT10R0.cfg
Setup ID: 0
Manipulated: 0
Filename 1:
Filename 2:
Date: quinta-feira, 24 de outubro de 2019
Time: 10:22:19
Sampling rate [Hz]: 16383
Measuring time [s]: 360
Delay time [s]: 0
Cycle time [s]: 0
Cycles: 1
Samples per channel: 5897881
Cycle interval: 0
Cycle No: 1
Time Ch1 Ch2 Ch3
s N N N
0,000000 0,0450134 0,0473022 0,0534058
0,000061 0,0465393 0,0442505 0,0564575
0,000122 0,0442505 0,0457764 0,0549316
0,000183 0,0434875 0,0465393 0,0541687
0,000244 0,0442505 0,0465393 0,0572205
0,000305 0,0465393 0,0465393 0,0549316
0,000366 0,0434875 0,0473022 0,0556946
0,000427 0,0457764 0,0457764 0,0549316
0,000488 0,0442505 0,0457764 0,0564575
0 个评论
采纳的回答
Stephen23
2019-11-5
编辑:Stephen23
2019-11-5
opt = {'HeaderLines',20};
fmt = repmat('%f',1,4);
str = fileread('temp0.txt');
C = textscan(strrep(str,',','.'),fmt,opt{:});
time = C{1};
Ch1 = C{2};
Ch2 = C{3};
Ch3 = C{4};
Giving:
>> [time,Ch1,Ch2,Ch3]
ans =
0 0.045013 0.047302 0.053406
6.1e-05 0.046539 0.04425 0.056458
0.000122 0.04425 0.045776 0.054932
0.000183 0.043487 0.046539 0.054169
0.000244 0.04425 0.046539 0.057221
0.000305 0.046539 0.046539 0.054932
0.000366 0.043487 0.047302 0.055695
0.000427 0.045776 0.045776 0.054932
0.000488 0.04425 0.045776 0.056458
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!