import data without header
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Stephen23
le 5 Nov 2019
Modifié(e) : Stephen23
le 5 Nov 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!