Converting a timestamp into a value that can be plotted
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I have a timestamp data in the format of '11/04/2022 12:23:58 PM' '11/04/2022 12:24:04 PM' ... etc.
For me to able to convert this in a format where it can be used to plot a voltage as a function of time, it seems like I have to make some changes. I tried some of the methods that can be found online, but they did not seem to apply for the format I have for timestamp.
Any help would be appreiciated!
댓글 수: 0
답변 (1개)
Star Strider
2023년 4월 18일
Perhaps something like one of these —
ts = ['11/04/2022 12:23:58 PM';'11/04/2022 12:24:04 PM'] % Text Time Stamps
dt = datetime(ts, 'InputFormat','dd/MM/yyyy hh:mm:ss a', 'Format','yyyy/MM/dd HH:mm:ss') % 'datetime' Array
du = diff([dt(1); dt]) % 'duration' Array
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!