bitget for array (count no. of bits)
이전 댓글 표시
Hi everyone,
How to take bitget of an array. Let say:
a = 7;
s = sum(bitget(a,1:8));
will return 3 as there are three bits on in number 7. If I have any array
a = [1 2 7 6];
then how can I do the similar bit count operation for each element in a.
채택된 답변
추가 답변 (1개)
Oliver Woodford
2013년 11월 22일
0 개 추천
I assume from your question that you actually want to do a vectorized bitcount, rather than a vectorized bitget. If that is correct then I suggest you use the bitcount submission on the File Exchange.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!