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

インデックスを作成するには、{} 演算子を使用します。

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

forループの代わりに関数「サイズ」を使用してください

于 2013-11-09T12:04:50.857 に答える