Remove all the vowels in the given phrase.
Input s1 = 'Jack and Jill went up the hill'
Output s2 is 'Jck nd Jll wnt p th hll'
What about y in the second test?
Why isn't y a vowel in english? In swedish we have nine vowels and y is one of them.
There is only five vowels in English.That is 'a,e,i,o,u'.
I don't understand why the following doesn't work:
expression = '[aeiouAEIOU]';
[~,noMatch] = regexp(s1,expression,'match','split');
[~,c] = size(noMatch);
cell_s2 = '';
for i = 1:c
cell_s2 = strcat(cell_s2,noMatch(i));
s2 = string(cell_s2);
Character Array And String are not similar.
so 'abc' is NOT EQUAL to "abc"
use "char" function to get character array from string
why no accept
I can't make this work on my PC (Matlab 2016 doesn't support double quotes and string arrays)
s1 = 'I don''t want to work. I just want to bang on the drum all day.';
How it is possible to read the string to the s1 including another quote at don''t
including lower() helped me with the capital I
'Y' is being considered as a consonant!
In addition to vowels, the second test also removes a space. While it's natural to want to clean up extra spaces, spaces are _not_ vowels.
The display of the test suite show the second space at the "I" being removed, but the actual test does not remove it. This is very confusing, but the test actually works as you would expect. It is just that the displayed "correct" answer is - in fact - not correct as you noted.
I had trouble with this as I saw your answer and accommodated their "error" in my solution. Except their error was only a display error and not an actual error in the test suite. Doh!
See https://www.mathworks.com/matlabcentral/cody/problems/22-remove-the-vowels/solutions/1218453 for a repaired version of your solution.
Of course I just noted that your solution is five months old, so you certainly won't care by now. C'est la vie.
Also should include other capitals
Anyone can see why this is not working? Works fine on my side.
Consider letter 'y'. It can be consonant or vowel, depend on context. More: http://en.wikipedia.org/wiki/Consonant#Letters
Initially I tried both ways with same results. My mistake was forgetting about the capital vowels. Thanks for the reply Jan.
very good solution!
can any one say what is the problem if we approch through ascii representation?
one "'" can make a very different situation between "regexp" and "regexpi".
For the second test-case, something is wrong.
* If you use the string that is given in S1 in MATLAB, you do NOT get the output that is listed.
* However, to get the output that is listed as the correct one, you cannot have the input that is given.
Regexp is apparently unable to detect the 'y' at the end of 'day'. This does not happen on my own computer. Very strange indeed.
Smaller but less explicit than 'ignorecase'. Anyway, good solution.
On my pc it works. Why not here?
Wait... how is this:
s2 = regexprep(s1,'[aeiouAEIOU]','');
s2 = s1(regexpi(s1,'[^aeiou]'));
I believe it is because the regexpi would be the same as including the 'ignorecase' option from regexprep command (including that makes the size 15).
Does it really matter if y is a vowel or not? XD
y or y not!!
thats the problem...
Remove any row in which a NaN appears
Arrange Vector in descending order
Back to basics 15 - Benchmark
Number of Horns on a unicorn!
Add a block to a model
Get the area codes from a list of phone numbers
Find the longest sequence of 1's in a binary sequence.
Find relatively common elements in matrix rows
Counting in Finnish
Back and Forth Rows
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office