Borrar filtros
Borrar filtros

Creating a matrix of different row sizes

4 visualizaciones (últimos 30 días)
Ritika Srinivasan
Ritika Srinivasan el 22 de Mzo. de 2022
Comentada: Ritika Srinivasan el 22 de Mzo. de 2022
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 comentarios
Matt J
Matt J el 22 de Mzo. de 2022
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 el 22 de Mzo. de 2022
thank you for the comment. the rest can be filled with zeros

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 22 de Mzo. de 2022
gridsupply=sorted_dailygrid.*((1:24)<=ddailygridhours)';

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by