Add for each element of a matrix the column vector in another dimension

1 view (last 30 days)
Hi!i have a matrix 136*136 that for each cell contains a value. This value is the index of a column of another matrix(24*391) that is associated. Now i want associate for each cell(136*136) the column vector and obtain a multidimensional array.. Any ideas?
  2 Comments
elena galvano
elena galvano on 23 Sep 2020
The first matrix is an area (136*136), and for each cell i want to add a series of data (that is contained in the second matrix (24*391).

Sign in to comment.

Accepted Answer

Matt J
Matt J on 22 Sep 2020
Edited: Matt J on 22 Sep 2020
Hi!i have a matrix 136*136.
Call this A.
This value is the index of a column of another matrix(24*391)
Call this B. Then,
result=reshape( B(:,A).', 136,136,[]) ;
  3 Comments
Matt J
Matt J on 23 Sep 2020
You're welcome, but please Accept-click the answer to indicate the issue is solved.

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!