How to get a sum of coloumnn linked to datetime?

1 view (last 30 days)
Hey Guys,
I got a .csv file and a stacked bar graph, right now the graph displays one value for every 15mins. I want to have a monthly view that shows the sum of all the values of the sum. My question is how do I convert the datetime into a MM/yyyy format and also sum up the values of that duration? I work in the appdesigner R2022b.
My code so far is:
function Bar_Monatliche_Erzeugung(app)
auswahl = [false false app.CheckBox.Value app.CheckBox2.Value app.CheckBox3.Value app.CheckBox4.Value app.CheckBox5.Value app.CheckBox6.Value app.CheckBox7.Value app.CheckBox8.Value app.CheckBox9.Value app.CheckBox10.Value app.CheckBox11.Value app.CheckBox12.Value];
for i = auswahl
if i == true
bar (app.UIAxes3, app.R.DatumUhrzeit,app.R{:,auswahl},'stacked');
end
end
if i == true
legend(app.UIAxes3,app.R.Properties.VariableNames(auswahl),'Location','northoutside');
app.UIAxes3.Title.String="Übersicht Monatliche Erzeugung";
app.UIAxes3.YLabel.String="Arbeit [MWh]";
app.UIAxes3.XLabel.String="Datum";
end
Thank you :)

Accepted Answer

Peter Perkins
Peter Perkins on 19 Dec 2022
Create a timetable from your data, and use retime to aggregate it to monthly. It's one line of code.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!