fourbittoint.m
来自「在matlab下模擬hamming codeing的編解碼過程,碼率為7/11,」· M 代码 · 共 16 行
M
16 行
%FourBitToInt.m
function out=FourBitToInt(FourBitMatrix)
%Takes a binary matrix of 4 columns and any even number of rows and
%constructs a column matrix by creating an integer by concatenating two
%consecutive rows in FourBitMatrix to form an 8 bit binary number and then
%converting that to a decimal.
[r,c]=size(FourBitMatrix);
out=uint8(zeros(r/2,1));
for i=1:r/2
for j=1:4
out(i)=out(i)+FourBitMatrix(2*i-1,j)*2^(8-j);
out(i)=out(i)+FourBitMatrix(2*i,j)*2^(4-j);
end
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?