How do I assign a vector to a logical matrix?
Show older comments
I currently have a logical matrix A representing a system's pupil. The matrix is 28x37, with 210 of the elements being logically true.
I also have vector B, of size 1x210.
I wish to assign the values of vector B to the true elements of matrix A, such that the result will be a 28x37 matrix with the values of vector B shown in the system's pupil.
I can use loops to scan for posisitve elements and then assign values to each element individually, but I sense there is a quicker way.
Any help would be much appreciated!
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!