This file format i want to extract time and Value. What should I do??
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (2)
Akira Agata
on 24 Apr 2022
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
Stephen23
on 24 Apr 2022
Edited: Stephen23
on 24 Apr 2022
tbl = readtable('textfile.txt','delimiter','\t')
tod = timeofday(tbl.Var1)
val = tbl.Var2
3 Comments
Stephen23
on 24 Apr 2022
Edited: Stephen23
on 25 Apr 2022
"but i want time values to milisecond order HH:MM:SS.FFF this should be the order"
Of course you can easily change the DURATION format (note that this does not change the stored values):
tbl = readtable('textfile.txt','delimiter','\t')
tod = timeofday(tbl.Var1);
tod.Format = 'hh:mm:ss.SSS' % <------- did you try changing the format?
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!