This file format i want to extract time and Value. What should I do??

2 ビュー (過去 30 日間)
Subhadip Paul
Subhadip Paul 2022 年 4 月 24 日
編集済み: Stephen23 2022 年 4 月 25 日
date time value
3/24/2022 11:35:02.882 AM 5.3259E-3 J
3/24/2022 11:35:02.781 AM 5.7541E-3 J
3/24/2022 11:35:02.682 AM 6.4423E-3 J
3/24/2022 11:35:02.580 AM 5.8835E-3 J
3/24/2022 11:35:02.482 AM 5.8464E-3 J
3/24/2022 11:35:02.379 AM 4.6127E-3 J
3/24/2022 11:35:02.281 AM 5.3186E-3 J
3/24/2022 11:35:02.180 AM 6.6594E-3 J
3/24/2022 11:35:02.084 AM 5.7444E-3 J
3/24/2022 11:35:01.977 AM 5.2880E-3 J
3/24/2022 11:35:01.883 AM 6.2769E-3 J
3/24/2022 11:35:01.776 AM 5.9235E-3 J
3/24/2022 11:35:01.685 AM 6.0936E-3 J
3/24/2022 11:35:01.576 AM 6.2709E-3 J
3/24/2022 11:35:01.486 AM 5.9826E-3 J
3/24/2022 11:35:01.376 AM 5.6830E-3 J
3/24/2022 11:35:01.283 AM 5.0717E-3 J
3/24/2022 11:35:01.178 AM 5.0543E-3 J
3/24/2022 11:35:01.086 AM 7.0480E-3 J
3/24/2022 11:35:00.977 AM 5.6264E-3 J

回答 (2 件)

Stephen23
Stephen23 2022 年 4 月 24 日
編集済み: Stephen23 2022 年 4 月 24 日
tbl = readtable('textfile.txt','delimiter','\t')
tbl = 599×3 table
Var1 Var2 Var3 __________________________ _________ _____ 03/24/2022 11:35:02.882 AM 0.0053259 {'J'} 03/24/2022 11:35:02.781 AM 0.0057541 {'J'} 03/24/2022 11:35:02.682 AM 0.0064423 {'J'} 03/24/2022 11:35:02.580 AM 0.0058835 {'J'} 03/24/2022 11:35:02.482 AM 0.0058464 {'J'} 03/24/2022 11:35:02.379 AM 0.0046127 {'J'} 03/24/2022 11:35:02.281 AM 0.0053186 {'J'} 03/24/2022 11:35:02.180 AM 0.0066594 {'J'} 03/24/2022 11:35:02.084 AM 0.0057444 {'J'} 03/24/2022 11:35:01.977 AM 0.005288 {'J'} 03/24/2022 11:35:01.883 AM 0.0062769 {'J'} 03/24/2022 11:35:01.776 AM 0.0059235 {'J'} 03/24/2022 11:35:01.685 AM 0.0060936 {'J'} 03/24/2022 11:35:01.576 AM 0.0062709 {'J'} 03/24/2022 11:35:01.486 AM 0.0059826 {'J'} 03/24/2022 11:35:01.376 AM 0.005683 {'J'}
tod = timeofday(tbl.Var1)
tod = 599×1 duration array
11:35:02 11:35:02 11:35:02 11:35:02 11:35:02 11:35:02 11:35:02 11:35:02 11:35:02 11:35:01 11:35:01 11:35:01 11:35:01 11:35:01 11:35:01 11:35:01 11:35:01 11:35:01 11:35:01 11:35:00 11:35:00 11:35:00 11:35:00 11:35:00 11:35:00 11:35:00 11:35:00 11:35:00 11:35:00 11:34:59
val = tbl.Var2
val = 599×1
0.0053 0.0058 0.0064 0.0059 0.0058 0.0046 0.0053 0.0067 0.0057 0.0053
  3 件のコメント
Subhadip Paul
Subhadip Paul 2022 年 4 月 25 日
Thank you stephen.
yes, i am really looking for it.

サインインしてコメントする。


Akira Agata
Akira Agata 2022 年 4 月 24 日
How about the following?
% Read and arange the data
url = 'https://jp.mathworks.com/matlabcentral/answers/uploaded_files/976045/textfile.txt';
TT = readtimetable(url,'Delimiter','\t');
TT.Properties.VariableNames = {'Value','Type'};
% Show the result
TT
TT = 599×2 timetable
Time Value Type __________________________ _________ _____ 03/24/2022 11:35:02.882 AM 0.0053259 {'J'} 03/24/2022 11:35:02.781 AM 0.0057541 {'J'} 03/24/2022 11:35:02.682 AM 0.0064423 {'J'} 03/24/2022 11:35:02.580 AM 0.0058835 {'J'} 03/24/2022 11:35:02.482 AM 0.0058464 {'J'} 03/24/2022 11:35:02.379 AM 0.0046127 {'J'} 03/24/2022 11:35:02.281 AM 0.0053186 {'J'} 03/24/2022 11:35:02.180 AM 0.0066594 {'J'} 03/24/2022 11:35:02.084 AM 0.0057444 {'J'} 03/24/2022 11:35:01.977 AM 0.005288 {'J'} 03/24/2022 11:35:01.883 AM 0.0062769 {'J'} 03/24/2022 11:35:01.776 AM 0.0059235 {'J'} 03/24/2022 11:35:01.685 AM 0.0060936 {'J'} 03/24/2022 11:35:01.576 AM 0.0062709 {'J'} 03/24/2022 11:35:01.486 AM 0.0059826 {'J'} 03/24/2022 11:35:01.376 AM 0.005683 {'J'}
  1 件のコメント
Subhadip Paul
Subhadip Paul 2022 年 4 月 24 日
thank you Akira, but i want to extract the time values to millisecond order and corresponding value.

サインインしてコメントする。

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by