Clear Filters
Clear Filters

How to change the year format in time series data? ("0017" to "2017")

2 views (last 30 days)
Hi. I need help. I want to ask about how to change the format of year in Matlab. I intend to concatenate horizontally two data based on the datetime data. Both data has the same range of datetime. However, turns out one data has this format for the year "0017' and the other is "2017", so that they can not concatenate. I want to ask about how to change 0017 to 2017, but not limited to 2017. For example if the data is based on 2018 time series data. One data would be 0018 and the other is 2018. I attach the two tables here. One with 0017 and the other with 2017. Once I change 0017 to 2017, they both can concatenate horizontally.
20.Nov.0017 00:00:00
20.Nov.0017 00:05:00
20.Nov.0017 00:10:00
20.Nov.0017 00:15:00
20.Nov.0017 00:20:00
20.Nov.0017 00:25:00
and the other data :
20.11.2017 00:00:00
20.11.2017 00:05:00
20.11.2017 00:10:00
20.11.2017 00:15:00
20.11.2017 00:20:00
20.11.2017 00:25:00
20.11.2017 00:30:00
Could you please help me? I am really stuck in this thing. Thank you very much for your help.
  1 Comment
per isakson
per isakson on 13 Dec 2017
Edited: per isakson on 14 Dec 2017
I fail to produce the output that you show from the contents of the mat-files, i.e from datalog and datasampling. Is that because I use 2016a?
>> whos data*
Name Size Bytes Class Attributes
datalog 6x1 24 uint32
datasampling 6x1 24 uint32
>> datalog'
ans =
3707764736 2 1 1 1 2
>> datasampling'
ans =
3707764736 2 1 1 1 2
>>

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 14 Dec 2017
datalog.DateAndTime = datalog.DateAndTime + years(2000);

More Answers (0)

Categories

Find more on Numeric Types in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!