Effacer les filtres
Effacer les filtres

How do I add a time column in the format of YYYY-MM-DD to my table?

2 vues (au cours des 30 derniers jours)
Saunok Chakrabarty
Saunok Chakrabarty le 3 Avr 2023
Commenté : Jon le 10 Avr 2023
I have a table containing time series data of some macroeconomic variables. My data is quarterly, starting from 1947-01-01 and ending on 2022-10-01. However, MATLAB is representing these dates numerically - eg, 1947-01-01 shows up as -725846400, after I imported the file into MATLAB from R. How do I change the time column to quarterly data in the range that I want?

Réponse acceptée

Jon
Jon le 3 Avr 2023
Modifié(e) : Jon le 3 Avr 2023
I think R stores dates as posix time.
You can use something like this to convert to datetime format eg 31-Dec-1969 23:59:56
d = datetime(-725846400, 'ConvertFrom', 'posixtime')
  5 commentaires
Saunok Chakrabarty
Saunok Chakrabarty le 6 Avr 2023
Works perfectly. Thanks a lot!
Jon
Jon le 10 Avr 2023
You're welcome

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by