lzw_demo1.m

来自「LZW压缩算法 一种新型的LZW压缩算法」· M 代码 · 共 24 行

M
24
字号
%LZW DEMO 1


%   $Author: Giuseppe Ridino' $
%   $Revision: 1.0 $  $Date: 10-May-2004 14:16:08 $


% string to compress
str = '/WED/WE/WEE/WEB/WET';

% pack it
[packed,table]=norm2lzw(uint8(str));

% unpack it
[unpacked,table]=lzw2norm(packed);

% transfor it back to char array
unpacked = char(unpacked);

% test
isOK = strcmp(str,unpacked)

% show new table elements
strvcat(table{257:end})

⌨️ 快捷键说明

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