MATLAB: Find number of vowels

createfunction

function findvowels
s=input('Insert a word: ', 's');
i=1;
w=0;
l=length(s);
for i=i:l
if s(i)=='a' || s(i)=='e' || s(i)=='i' || s(i)=='o' || s(i)=='u', w=w+1;
end
end
Good morning, I want to create a function where u enter a word and MATLAB counts the vowels. I run it but nothing exits, any ideas to resolve this?

Best Answer

s=input('Insert a word: ', 's');
Number_of_vowels = vowelcounts(s) %function calling
function w = vowelcounts(s) %function definition
w=0;
l=length(s);
for i=1:l
if s(i)=='a' || s(i)=='e' || s(i)=='i' || s(i)=='o' || s(i)=='u'
w=w+1;
else
continue
end
end
end