matlab help

edited May 2011 in Science & Tech
hi everybody
i just need some help with matlab
say you have an array [10 4 7]
and have a variable you got from a different function say y=8
and i want to find which column in the array has a binary 1 at the highest binary 1 of y so in this case 10=[1010] 4=[0100] 7=[0111] and y=8=[1000] so the highest binary 1 of y is at 8 and i want to find which number or column in the array has a 1 at 8. so the column which has a binary 1 at the same place as the highest binary 1 of y is column 1 which is number 10.and it doesnat matter if there are 2 columns with this property i just need to find out which columns have a binary 1 at the highest binary 1 of y.

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited May 2011
    1) convert numbers to binary
    2) bitwise AND them with y
    3) find number which still has the highest 1
Sign In or Register to comment.