필터 지우기
필터 지우기

Creating a matrix of different row sizes

조회 수: 4 (최근 30일)
Ritika Srinivasan
Ritika Srinivasan 2022년 3월 22일
댓글: Ritika Srinivasan 2022년 3월 22일
Hello,
I have a matrix called sorted_dailygrid of size 24x 365 and another matrix called dailygridhours of size 365x1. I would like to create a new matrix called gridsupply with 365 colums but the row size would vary depending on the value in dailygridhours. For example if the first value in dailygridhours is 10 then the first column of gridsupply will contain the values of the first 10 rows of the first column in sorted_dailygrid and so on until the gridsupply matrix has 365 columns.
I would appreciate any help!
  댓글 수: 2
Matt J
Matt J 2022년 3월 22일
For example if the first value in dailygridhours is 10 then the first column of gridsupply will contain the values of the first 10 rows of the first column in sorted_dailygrid and so on until the gridsupply matrix has 365 columns.
What should be contained in the remaining rows?
Ritika Srinivasan
Ritika Srinivasan 2022년 3월 22일
thank you for the comment. the rest can be filled with zeros

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

채택된 답변

Matt J
Matt J 2022년 3월 22일
gridsupply=sorted_dailygrid.*((1:24)<=ddailygridhours)';

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by