Add for each element of a matrix the column vector in another dimension
1 view (last 30 days)
Show older comments
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
Accepted Answer
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
on 23 Sep 2020
You're welcome, but please Accept-click the answer to indicate the issue is solved.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!