⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcm_decode.m

📁 i hope use every file i put here to evry one and thank >
💻 M
字号:
function [data] = pcm_decode(code,num_array)

global H

% get BITS
s = get(H.edit20,'String');
BITS = st2de(s);
BITS = round(BITS);

%  initialize binary_array used to represent data
bin_array = de2bi(0,BITS);

% create binary_array used to represent data
for j = 2:length(num_array),
   bin_array(j,:) = de2bi(j - 1, BITS);
end

% number of blocks of N bits
blocks = length(code) / BITS;

% initialize data array
data = 0;

% initialize code index
index = 1;

for j = 1:blocks,
   
   % find decimal equivalent to binary block
   dec = bi2de(code(index:index + (BITS - 1)));
   
   % decimal number plus one represents the index of the number array
   % where the data is held
   data(j) = num_array(dec + 1);
   
   % update index
	index = index + BITS;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -