suanshubianma.m
来自「matlab写的lzw和huffman的编码」· M 代码 · 共 32 行
M
32 行
clc;
clear;
p=[0.1 0.2 0.3 0.4 ];
disp('abcd');
disp=(num2str(p));
strc='dcba';
[m n]=size(strc);
first=0;last=1;
for i=1:n
letter=strc(i);
value=last-first;
switch(letter)
case 'a'
c1=first;
c2=first+value*0.1;
case 'b'
c1=first+value*0.1;
c2=first+value*0.3;
case 'c'
c1=first+value*0.3;
c2=first+value*0.6;
case 'd'
c1=first+value*0.6;
c2=last;
otherwise
errordlg('The input is fault','input error');
end
first=c1;last=c2;
end
[first last]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?