import data without header

11 visualizaciones (últimos 30 días)
ilson
ilson el 5 de Nov. de 2019
Comentada: ilson el 7 de Nov. de 2019
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

Respuesta aceptada

Stephen23
Stephen23 el 5 de Nov. de 2019
Editada: Stephen23 el 5 de Nov. de 2019
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 comentarios
ilson
ilson el 5 de Nov. de 2019
Show, thanks ...
ilson
ilson el 7 de Nov. de 2019
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by