Remove all the consonants using MATLAB

Program to remove consonants from a String

Prerequisite:

How to remove all the vowels from a string:


Reference(ASCII TABLE)




Code to remove all the consonants:

clc
x=input('Enter the sentence:');
w=double(x);
Y=[];
for i=1:length(x)
    q=w(i);
    if((q>=65 && q<=90) || (q>=97 && q<=122))
    if(q==65 || q==69 || q==73 || q==79 || q==85 || q==97 || q==101 || q==105 || q==111 || q==117)
        Y=[Y q];
    end
    else
        Y=[Y q];
    end
end
a=char(Y)

Explanation:



Output:

No comments