필터 지우기
필터 지우기

How to group a collection of values in a vector?

조회 수: 4 (최근 30일)
Paul Torres
Paul Torres 2018년 7월 11일
댓글: Paul Torres 2018년 7월 17일
I have a data set that is made up of measurements done every 6 hours over the course of a year. So that is 1460 for an ordinary year and 1464 for a leap year. I am having trouble grouping them so that the values of each 4x6 hour group is averaged into a day.
Each year is a vector.

채택된 답변

Rik
Rik 2018년 7월 11일
There are a myriad of way to do this, one of them should be the code below.
data=1:12;%example data
data=reshape(data,4,[]);%reshape so each day is a column (hence 4 rows)
dayly_mean=mean(data,1);
  댓글 수: 2
Rik
Rik 2018년 7월 14일
Did this suggestion solve your problem? If so, please consider marking it as accepted answer. It will make it easier for other people with the same question to find an answer. If this didn't solve your question, please comment with what problems you are still having.
Paul Torres
Paul Torres 2018년 7월 17일
No, this solved the problem perfectly without me having to go through the trouble of creating a for loop. Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by