help with summing the values of a table and storing in a matrix

조회 수: 2 (최근 30일)
Thiago Todesco
Thiago Todesco 2021년 10월 9일
답변: Cris LaPierre 2021년 10월 9일
I have data file that reports 6 columns: the day, month, year, high temperature of given day, average temp of given day and low temperature of the given day
I need to find the average of the high temperature of each month of each year, but I can't see to figure out the part that I have to sum the points of the high temperatures for each month because the data has to be stored as the rows being the month(1-12) and the column for the year(1-3)
the original data file was broken down to vectors for each variable(day,month,hightemp,...), so far I have on my program
how could I sum the values for the high temperatures and store it into a matrix
Thank you!

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 10월 9일
Use groupsummary. It should be something like this
avgHigh = groupsummary(hightemp,[year,month],'mean')

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by