how can i reshape an indexed vector
Show older comments
Hello,
I have the following problem:
Q % e.g. 300 x 300 matrix
M % e.g. 300 x 300 matrix
omega=find(Q); % omega becomes a 86567x1 vector
b= M(omega);% b is also a 86567x1 vector
Is there a way to reshape b to have the same dimension as Q?
Accepted Answer
More Answers (1)
KSSV
on 2 Nov 2020
Whn you use find you will get the global indices in the form of column array...YOu can use logical indexing, so that you can have your matrix dimensions intact with 1 where condition is obeyed and 0 where condition is not.
omega = Q~=0;
Categories
Find more on Matrix Indexing 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!