How can I transform these data in timetable?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Pul
am 5 Sep. 2021
Kommentiert: Star Strider
am 5 Sep. 2021
Hello everyone,
I should transform the first 3 column in timetable ( 1 Jan 1998, 1 Jan 1999 ecc...).
How can I do it?
Thank you very much,
0 Kommentare
Akzeptierte Antwort
Star Strider
am 5 Sep. 2021
Bearbeitet: Star Strider
am 5 Sep. 2021
I am not certain what you are asking.
If you want to turn the first 3 variables into a dateime variable, this works —
LD = load('DATA.mat');
c = struct2cell(LD);
T1 = c{:};
T1.YMD = datetime(T1.Year,T1.Month,T1.Days);
First10Rows = T1(1:5,:)
producing —
First10Rows =
5×20 table
Year Month Days SMB_larsenmm TP_larsenmm SF_larsenmm ES_larsenmm SMB_priestleymm TP_priestleymm SF_priestleymm ES_priestleymm SMB_talosmm TP_talosmm SF_talosmm ES_talosmm SMB_mpmm TP_mpmm SF_mpmm ES_mp_mmi YMD
____ _____ ____ ____________ ___________ ___________ ___________ _______________ ______________ ______________ ______________ ___________ __________ __________ __________ __________ _________ _________ __________ ___________
1998 1 1 -0.1223 0.15577 0.1562 -0.27807 -0.18414 2.8e-06 0.0015335 -0.18414 0.015194 0.018041 0.018084 -0.0028467 -0.002903 2.8e-06 0.0001269 -0.0029058 01-Jan-1998
1998 1 2 -0.38258 2.8e-06 2.8e-06 -0.38258 -0.27416 0.0004992 0.0001269 -0.27466 0.076073 0.068516 0.071046 0.0075563 0.000926 2.8e-06 0.0006234 0.0009232 02-Jan-1998
1998 1 3 -0.2277 0.11163 0.11329 -0.33933 -0.049567 0.17025 0.17076 -0.21982 0.87941 0.88927 0.88977 -0.0098669 -0.0053178 2.8e-06 0.0006647 -0.0053206 03-Jan-1998
1998 1 4 -0.36473 0.0014508 0.002361 -0.36618 -0.19776 0.019076 0.016429 -0.21684 0.16956 0.18026 0.18086 -0.0107 -0.0002722 2.8e-06 0.0001269 -0.000275 04-Jan-1998
1998 1 5 -0.36937 2.8e-06 2.8e-06 -0.36937 -0.21912 2.8e-06 2.8e-06 -0.21912 -0.0068196 2.8e-06 0.0006232 -0.0068224 0.0018871 0.0004992 0.0007888 0.0013879 05-Jan-1998
The ‘YMD’ variable is concatenated to the end of the existing table as the variable. .
.
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!