why bitand function is not running even i specified the assumedtype value still error comes
조회 수: 4 (최근 30일)
이전 댓글 표시
for i = 1:2^samples-2
j = bitset(bitshift(i,1),1,bitget(i,samples)); %rotate left
numt = sum(bitget(bitxor(i,j),1:samples)); %number of 1->0 and 0->1 transitions
if numt == 2 %Uniform pattern
n=sum(bitget(i,1:samples)); %Number of 1-bits
c= bitcmp(j,'uint8');
b=bitand(i,c,'unit64');
r=find(bitget( b,1:samples)); %Rotation index of the bit pattern
r=mod( floor(n/2)+r , samples);
index = (n-1)*samples + r;
table(i+1) = index;
else %Non-uniform
table(i+1) = newMax - 1;
end
end
Here samples=8;
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 9월 13일
uint64 not unit64
댓글 수: 1
Guillaume
2018년 9월 13일
Considering that c is limited to 8 bits, might as well make that uint8 for the bitand as well.
Note that j should be limited to 8 bits prior to the bitcmp otherwise bitcmp will throw an error for larger i (e.g. when i = 207), so:
j = mod(j, 256);
참고 항목
카테고리
Help Center 및 File Exchange에서 Functions for Programming and Data Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!