Expanding the existing Matrix

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

 Accepted Answer

Stephen23
Stephen23 on 23 Feb 2020
Edited: Stephen23 on 23 Feb 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.

More Answers (0)

Categories

Asked:

on 23 Feb 2020

Edited:

on 23 Feb 2020

Community Treasure Hunt

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

Start Hunting!