How to classify data from text file?

1 次查看(过去 30 天)
Hello, Here is the text file ' data.txt '
here is the sample of data.
16:21:32.556 AcX= 17080 AcY= 764 AcZ= -3244 GyX= -4144 GyY= -8583 GyZ= 652 Tmp= 36.98562,641
16:21:32.693 AcX= 17016 AcY= -700 AcZ= -1760 GyX= -4144 GyY= -8709 GyZ= 260 Tmp= 35.50484,607
16:21:32.736 AcX= 17716 AcY= 1432 AcZ= -3916 GyX= -4144 GyY= -8972 GyZ= 750 Tmp= 37.26528,611
16:21:32.825 AcX= 17016 AcY= 1436 AcZ= -2892 GyX= -4144 GyY= -9139 GyZ= 199 Tmp= 35.64521,612
16:21:32.917 AcX= 17156 AcY= 1008 AcZ= -3624 GyX= -4160 GyY= -9302 GyZ= 776 Tmp= 36.75466,586
16:21:33.007 AcX= 17224 AcY= 2776 AcZ= -3508 GyX= -4160 GyY= -9425 GyZ= 299 Tmp= 36.51524,602
16:21:33.097 AcX= 16328 AcY= 180 AcZ= -2648 GyX= -4160 GyY= -9431 GyZ= 519 Tmp= 35.68504,598
I want to classify data such as
AcX={17080 17016 17716...}
AcZ={-3244 -1760 -3976 -2892...}
Time={32.556 32.693 32.825...}
Tmp={36.98562... 35.50484...}
but I have no idea how to classify it.
Please refer this sample is kind of text file.
Thanks!

采纳的回答

Mathieu NOE
Mathieu NOE 2020-11-29
hello
when you say "classify" I believe you meant access the data inside the txt file ?
you can use readtable like this :
T = readtable('dataX.txt')
AcX= T.Var3;
AcZ= T.Var5;
% and so on ...
% T =
%
% 7×15 table
%
% Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15
% ____________ ________ _____ ________ ____ ________ _____ ________ _____ ________ _____ ________ _____ ________ ________________
%
% 16:21:32.556 {'AcX='} 17080 {'AcY='} 764 {'AcZ='} -3244 {'GyX='} -4144 {'GyY='} -8583 {'GyZ='} 652 {'Tmp='} {'36.98562,641'}
% 16:21:32.693 {'AcX='} 17016 {'AcY='} -700 {'AcZ='} -1760 {'GyX='} -4144 {'GyY='} -8709 {'GyZ='} 260 {'Tmp='} {'35.50484,607'}
% 16:21:32.736 {'AcX='} 17716 {'AcY='} 1432 {'AcZ='} -3916 {'GyX='} -4144 {'GyY='} -8972 {'GyZ='} 750 {'Tmp='} {'37.26528,611'}

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Automotive 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by