The code sets the bottom bit of a location in B to be the same as the value of msgmat() at a location.
idx(uu+7*(vv-1)) would work out the same as idx(uu,vv) provided that idx had 7 rows.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!