in lz78 what is "??? Error using ==> cell.ismember at 28" and "Error in ==> lz78 at 19"
Show older comments
datain=input('enter the string in single quote with symbol $ as End of string =');%input data
lda=length(datain);
dictionary=input('enter the dictionary in single quote(symbol used in string are to be included)=');%input dictionary
ldi=length(dictionary);
%for i=1:ldi
%dictnew(i)={dictionary(i)};
%end
dictnew(1)=datain(1);
s=dictnew(1);
i=1;
j=1;
k=1;
while datain(i)~= '$'
c=datain(i);
if c~='$'
check=ismember(dictnew,c);
if(check==0)
if datain(i)=='$'
break
end
dictnew(j+ldi)=datain(i);
i=i+1;
j=j+1;
else
s=datain(i+1);
cat=strcat(c,s);
check=ismember(dictnew,cat);
if(check==0)
if datain(i+1)=='$'
break
end
dictnew(j+ldi)={cat};
i=i+2;
j=j+1;
else
s=datain(i+2);
cat=strcat(cat,s);
if datain(i+2)=='$'
break
end
dictnew(j+ldi)={cat};
i=i+3;
j=j+1;
end
end
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!