from
RUN LENGTH DECODING
by Shoeb Temrikar
returns binary data from run length encoded array
|
| rle_decoding.m |
%
% RUN LENGTH DECODING
rle=input('enter run length encoded matrix: ');
% loop to calculate length of binary data matrix
l=0;
for t=2:length(rle)
l=l+rle(t);
end
a=false(1,l); % preallocate array
a(1)=rle(1);
m=2;n=1;
for i = 2:length(rle)-1
for j=1:rle(m)
a(n+1)=a(n); n=n+1;
end
m=m+1;a(n)=~a(n);
end
a=double(a); %ignore if u want output matrix as logical
display(a);
|
|
Contact us at files@mathworks.com