How to get the full precision on timestamp after using canSignalImport?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
When I get the timetable from the result of canSignalImport function, I got the timetable with limited precision of timestamp although the input '.ASC' file is having more detailed precision of the timestamp.
For example, the input '.ASC' file is having number of '6321.869787', but the actual result on the timetable is '6321.9.'
However, I can see more precision on the result of canMessageImport function.
>> outMsgImport(1)
ans =
Message with properties:
Message Identification
ProtocolMode: 'CAN'
ID: 272
Extended: 0
Name: 'XXXXXXXX'
Data Details
Timestamp: 6.3219e+03
Data: [240 0 0 0 0 0 0 240]
Signals: [1×1 struct]
Length: 8
Protocol Flags
Error: 0
Remote: 0
Other Information
Database: [1×1 can.Database]
UserData: []
Is there anyway to create the timetable with more detailed precision in the timestamp?
Also, when I tried to change the output precision format to 'long' by using 'format long' command, I can see some more digits on the timetable from canSignalImport function. Is this the only solution?
0 comentarios
Respuestas (1)
Animesh
el 19 de Jun. de 2023
Hey @Il-Taek Kwon
I understand that you need more precision in your timestamp value, long format is one way to do it and it gives a precision of 15 digits after the decimal.
You can also use datetime function instead which converts your timestamp to datetime object, which have higher precision than their numeric counterpart.
time = datetime(timetable_data.Timestamp, 'ConvertFrom', 'datenum');
Note that, unlike the "format long" method, which only affects the display of the data, creating datetime objects maintains the actual precision of data.
You can refer the following documentation for more details:
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!