I have a function:
function [ vowels ] = findVowels( charCell )%FINDVOWELS
% charCell: a two-dimensional cell array and each cell contains a
% character array
% vowels: a cell array with the same dimensions as charCell that contains
% only the vowels of each entry, in lower case
vowels=charCell;switch vowels case strfind(charCell, 'a') disp('a') case strfind(charCell, 'e') disp('e') case strfind(charCell, 'i') disp('i') case strfind(charCell, 'o') disp('o') case strfind(charCell, 'u') disp('u')endend
And I want the function to search for the vowels and RETURN those vowels for example:
>>X={'hi','hello';'goodbye', 'later'};>>findVowels(X)ans=2x2 cell array'i' 'eo''ooe' 'ae'
My current function results in an error because vowels is not a scalar or a character. How do I go about this to produce a character?
Best Answer