Answer to Question #2996 in MatLAB | Mathematica | MathCAD | Maple for geminia
I just need a little help with matlab <br>
say if you have an array [2 5 10]<br>
and you have a result from a different function say y=8<br>
and want to find which numbers of the array have the same highest binary digit with y in the case <br>above y= and 2= 5= 10= so the only number in the array which has the same highest binary digit with 8 is 10.
<br>How can i do this in matlab?
function mx=q2996(y,x) n=floor(log2(y)+1); l=length(x); mx=; for k=1:l if floor(log2(x(k))+1)==n mx=[mx x(k)]; end; end;