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
if ~any(s1(i) == 'aeiouAEIOU')
makes it real easy
The letters 'w' and 'y' are actually vowels.
(Perhaps not in Cody, perhaps not even in American English - I am not sure - but for certain they are in English...)
function s2 = refcn(s1)
s2 = ;
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...
Counting in Finnish
Find the largest value in the 3D matrix
Vectorize the digits of an Integer
Dimensions of a rectangle
Remove all the consonants
Test for balanced parentheses
Remove any row in which a NaN appears
Find the treasures in MATLAB Central and discover how the community can help you!
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