0

所以我的代码是:

my5Sentences={'Windows machines are better than Macs.','The Intel core i7 4770k is a great processor.','My email is xxxxx@drexel.edu','I go to Drexel','I am writing this in MATLAB & and I writing this code for Engr-180'}

for 1:length(my5Sentences)

现在,我不确定在 for 循环中要做什么来索引句子并检查字符大小。

4

2 回答 2

0

使用函数“size”而不是 for 循环

于 2013-11-09T12:04:50.857 回答
0

要索引,请使用 {} 运算符:

for i=1:(my5sentences)
    fprintf('length(%s)=%i',my5Sentences{i},length(my5Sentences{i}))
于 2013-11-09T12:05:40.130 回答