MATLAB Answers

Expand vector into 3-D matrix

조회 수: 2(최근 30일)
Brian DeCicco
Brian DeCicco 2021년 7월 1일
편집: Matt J 2021년 7월 1일
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!!

채택된 답변

Matt J
Matt J 2021년 7월 1일
편집: Matt J 2021년 7월 1일
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);

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by