You are on page 1of 1

symbolize

function sym=symbolize(msg)
%% Function that finds each and every distinct symbol present in msg string
%% sym stores the array of distinct symbols
sym(1)=msg(1);
l=length(msg);

%% First symbol of the msg is always unique

%% uniqeness of the next symbols are checked


j=2;
for i=2:l
k=msg(i);
check='T';
%% initially unique symbol is assumed
%% check for match in already existing symbols
for x=1:j-1
if(k==sym(x))
check='F'; %% uniqness set to false if there is a match
end
end
if(check=='T')
%% symbol array appended for true uniqeness found
sym(j)=k;
j=j+1;
end
end

Page 1

You might also like