How to get a sum of coloumnn linked to datetime?

1 次查看(过去 30 天)
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 :)

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by