how to remove vowels using matlab ?
Mostra commenti meno recenti
pleas help me to answer this following question :
Remove all the vowels in the given phrase.
Example:
Input s1 = 'Jack and Jill went up the hill'
Output s2 is 'Jck nd Jll wnt p th hll'
6 Commenti
Walter Roberson
il 1 Ott 2013
Is "y" a vowel or not? If it is "sometimes" a vowel, should it be removed only if it is acting as a vowel?
ES
il 1 Ott 2013
Hi Walter, I looked at the Question, and then the answer. I thought it is done and the challenge is off. And cometh you., the man, with a new challenge.:)
Walter Roberson
il 1 Ott 2013
Consider "yellow" and "yip" and "cry" and "ytterbium"
"y" is called a "semi-vowel". There are other semi-vowels used in English tat might have different rules. "w" is also considered a semi-vowel, but not (for example) in "vowel" or "cow"; notice the completely different "w" sound in "won" and "when".
"w" is also a semi-vowel, and acts like a vowel in situations such as "won" (followed by a short vowel), "wine" (followed by a long vowel), and "when" (followed by an "h" followed by a vowel.) But "w" does not act as a vowel in the word "vowel" nor in "how"
Andreas Goser
il 1 Ott 2013
And Ä, ä, Ö, ö, Ü, ü :-)
Walter Roberson
il 1 Ott 2013
I don't think those are semi-vowels, Andreas :)
Andreas Goser
il 1 Ott 2013
Ah, I wasn't responding to Walter but was more generally mentioning such strange characters exist.
Risposte (3)
Jothi
il 1 Ott 2013
3 voti
vow={'a','e','i','o','e'};
s1 = 'Jack and Jill went up the hill'
for i=1:5
output = strrep(s1, vow{i}, '');
s1=output;
end
output =
Jck nd Jll wnt up th hll
2 Commenti
Jan
il 1 Ott 2013
@Jothi: vow need not be a cell. strrep is efficient, but this is an alternative:
vow = 'aeioe';
s1 = 'Jack and Jill went up the hill'
for k = 1:5
s1(s1 == vow(k)) = [];
end
shivam verma
il 2 Dic 2018
jothi i think your answer is not working, can you please check again?
output = s1(~ismember(s1, 'aeiou'));
And considering uppercase vowels:
output = s1(~ismember(lower(s1), 'aeiou'));
Andrei Bobrov
il 1 Ott 2013
Modificato: Andrei Bobrov
il 1 Ott 2013
regexprep(s1,{'a','e','i','o'},repmat({''},1,4))
or
regexprep(s1,'[aeio]','')
1 Commento
Walter Roberson
il 1 Ott 2013
Too efficient for a beginner answer. As was the answer I almost posted but decided against a second ago.
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!