Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
%This is a Matlab code
%Instructions:
%1.- Get the ascii code of the lyrics, I suggest
% https://www.browserling.com/tools/text-to-ascii for that
%2.- Copy the ascii code and run the program
%3.-Enjoy
%Also, letra is the translation of lyrics in spanish
letra=input('Put the lyrics in ascii code','s');
letra(letra==10)=32;
letra=char(letra);
space=[];
s=1;
n=length(letra);
for i=1:n
if letra(i)==' '
space(s)=i;
s=s+1;
end
end
space=[space,n];
n=length(space);
m=zeros(n,n);
x_f=1;
y_f=1;
for i=1:n
x_t=space(i);
x_str=letra(x_f:x_t);
x_f=x_t+1;
for j=1:n
y_t=space(j);
y_str=letra(y_f:y_t);
y_f=y_t+1;
pat = isequal(x_str,y_str);
if pat == 1
m(i,j)=100/length(x_str);
end
end
end
image(m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.