Please complete this question matlab. Do not make it a function. Thank you! Home
ID: 3909033 • Letter: P
Question
Please complete this question matlab. Do not make it a function. Thank you!
Homework Problem 2: Find Vowels In this problem, create a script file name findVowels.m. In the first line, define a two-dimensional cell array charCell. Each cell contains a character array. Create vowels which is a cell array with the same dimensions as charCell that contains the vowels of each entry. Your code should be able to reproduce the following test case: If charCell is defined as charCell'Sushrut', Pande' then your array vowels should be: >> vowels = 2x2 cell array Engineering', Seven'; ae Eieei ee Store the code of this problem in the filename findVowels.m. This file must go into your zipped folder as it will be evaluatedExplanation / Answer
Given below is the code for the question.
Please do rate the answer if it was helpful. Thank you
charCell = {'Sushrut', 'Pande'; 'Engineering', 'Seven'};
[m, n] = size(charCell);
vowels = cell(m, n);
for row = 1 : m
for col = 1 : n
s = char(charCell(row, col)); %get the value at row, col
indices = ismember(s, "aeiouAEIOU"); %find the indices of all vowels
vowels(row, col) = s(indices); %get only characters of those matched vowel indices
end
end
vowels
=====
output
======
vowels =
{
[1,1] = uu
[2,1] = Eieei
[1,2] = ae
[2,2] = ee
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.