sum in sequence, string, matrix

조회 수: 7 (최근 30일)
Nikola Ostojic
Nikola Ostojic 2021년 1월 16일
댓글: Star Strider 2021년 1월 16일
I have a 1x8760 matrix (hours per year). I need to add up 24h and make a 1x365 or 365x1 matrix.
example: sum of values ​​1-24 in 1x1
sum of values ​​25-48 in 1x2 ..

채택된 답변

Star Strider
Star Strider 2021년 1월 16일
Try this:
M = 1:8760; % Create Vector
Mr = reshape(M, 24, []); % Reshape Vector
MeanMr = mean(Mr); % Take Column Means
.
  댓글 수: 3
Star Strider
Star Strider 2021년 1월 16일
Sorry. I misread your Question. Replace mean with sum. They operate the same way.
Star Strider
Star Strider 2021년 1월 16일
As always,. my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by