How to get a sum of coloumnn linked to datetime?

조회 수: 1 (최근 30일)
Frank
Frank 2022년 12월 17일
댓글: Frank 2022년 12월 21일
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