how to create table Date/Value
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Luca Re
am 7 Jan. 2024
Kommentiert: Star Strider
am 7 Jan. 2024
i have this data (pic1) and i want similar pic2
Do I have to create the table by entering the values manually or is there a function to do this?
1 Kommentar
Dyuman Joshi
am 7 Jan. 2024
Unless you provide specific and necessary details, in written form, explaining what the expected output is, I will be closing the question.
Akzeptierte Antwort
Star Strider
am 7 Jan. 2024
Try this —
LD = load('matlab_data.mat')
T1 = table(year(LD.dat),month(LD.dat,'shortname'),LD.prof)
ResultSum = unstack(T1, 'Var3', 'Var2');
ResultSum.Properties.VariableNames{1} = 'Year'
The unstack function sums the data by default for each month. Other options are available by defining the appropriate function.
Example —
ResultMean = unstack(T1, 'Var3', 'Var2', 'AggregationFunction',@mean);
ResultMean.Properties.VariableNames{1} = 'Year'
.
6 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!