Info
This question is closed. Reopen it to edit or answer.
How to assign indices to each row of a matrix according to a given codebook?
1 view (last 30 days)
Show older comments
Suppose that we have a 10^6 by 3 matrix A with binary ( 0 or 1) elements. On the other hand, we have a codebook like
codebook =[0,1,1 ; 0,0,1 ; 0,1,0 ; 0,0,0 ; 1,0,0 ; 1,1,0 ; 1,0,1 ; 1,1,1];
I'm looking for a fast code to generate a 10^6 by 1 matrix ( Index ) which shows the corresponding row number for each row according to the codebook . For example if the second row of the A is [1 0 0], the second element of the Index must be 5.
Thanks for your help.
0 Comments
Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!