Expand vector into 3-D matrix

4 vues (au cours des 30 derniers jours)
Brian DeCicco
Brian DeCicco le 1 Juil 2021
Modifié(e) : Matt J le 1 Juil 2021
Hello, I am trying to expand a 1x117 vector of values into a 3-D matrix of dimensions 1440x721x117. I would like the first first 2 dimensions to be longitude (1440x1) and latitude (720x1) values, and the 3rd dimension will be 117 time steps. Each time step is represented by its own unique value for each point globally. For example, the value at the first time step is -10.3685, so this value should be the same at every longtitude/latitude point. How would I write this...would I need to concatenate? Thanks!!

Réponse acceptée

Matt J
Matt J le 1 Juil 2021
Modifié(e) : Matt J le 1 Juil 2021
It seems like a waste of memory to make so many copies, but here is how it could be done:
result = repmat(reshape(vector,1,1,[]) ,1440 721);

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by