Expanding the existing Matrix

2 visualizaciones (últimos 30 días)
Artele
Artele el 23 de Feb. de 2020
Editada: Stephen23 el 23 de Feb. de 2020
Hello,
I have matrix 365 x 1, how can I expand the matrix into 8760 x 1 -> (365 times 24), replacing all the newly added numbers with every 24th number.
eg: matrix [2,4,5,2,3 .... ] -> [2,2,2,2,2,...,2,2,4,4,4,...,4,4,4,...and so on).
I would be really grateful for help

Respuesta aceptada

Stephen23
Stephen23 el 23 de Feb. de 2020
Editada: Stephen23 el 23 de Feb. de 2020
Use repelem or kron, e.g. where V is your input vector:
Z = repelem(V,24)
or
Z = kron(V,ones(24,1)) % adjust to suit V's orientation.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by