我在 Matlab 中有一个单元格,里面有 5 个字符串,每个字符串都是一个句子,我想使用 Matlab 命令提取每个句子中特殊字符的数量和元音的数量。我该怎么做?
这是我的代码:
sentences={['Dogs are cool!'];['They love to have their bellies scratched!'];['They love to run around and play in the grass.'];['Each normal year is equal to seven dog years.'];['Its sad when dogs die.']}
sentences1=length(sentences{1})
sentences2=length(sentences{2})
sentences3=length(sentences{3})
sentences4=length(sentences{4})
sentences5=length(sentences{5})
fprintf('There are %d, %d, %d, %d characters in each sentence respectively. ', sentences1,sentences2,sentences3,sentences4,sentences5)