convert dates in matlab

1 visualizzazione (ultimi 30 giorni)
Sana Ejaz
Sana Ejaz il 17 Giu 2019
Commentato: Star Strider il 17 Giu 2019
Hi all,
Need urgent help. I have dates in excell in a format of 19800101(this is 1st jan 1980).
I want to convert them to datenum in matlab.I have attached the excell file with the date column.
I want to convert dates in this column to matlab dates of any format.I tried converting it using different functions but failed.
would someone be able to help?

Risposta accettata

Star Strider
Star Strider il 17 Giu 2019
Try this:
D = xlsread('dates.xlsx');
Ds = num2str(D,'%d');
Dn = datenum(Ds, 'yyyymmdd');
Check = datevec(Dn) % Check Conversion (Delete Later)
The first five :
Check =
1986 1 2 0 0 0
1986 1 3 0 0 0
1986 1 6 0 0 0
1986 1 7 0 0 0
1986 1 8 0 0 0
  2 Commenti
Sana Ejaz
Sana Ejaz il 17 Giu 2019
Thanks Alot it worked.
Star Strider
Star Strider il 17 Giu 2019
As always, my pleasure.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Time Series Objects in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by