import data without header

조회 수: 7 (최근 30일)
ilson
ilson 2019년 11월 5일
댓글: ilson 2019년 11월 7일
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

채택된 답변

Stephen23
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
  댓글 수: 2
ilson
ilson 2019년 11월 5일
Show, thanks ...
ilson
ilson 2019년 11월 7일
Sorry to return in the post,
I have one more difficulty.
Some exported files have different settings.
Instead of having (,) has (.)
Can you convert to (,) on import?
Example:
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개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by