Design choice for iterating over a cell array
1 件のコメント
"Is there any good reason why the language was designed this way?"
Consistency. All arrays can be iterated over, and for all arrays the index variable is one element (or one column) of that array, no matter what class. People often forget that for actually loops over the columns, which would lead to awkward bugs/inconsistencies/... if the contents of cell arrays were returned in the index.
採用された回答
その他の回答 (1 件)
1 投票
4 件のコメント
And if you really want to, you can always insert the line below, just after your for statement (which suppresses the warning as well).
x=x{1};%#ok
Is that a setting buried somewhere deep? Because for me it doesn't offer to hide the warning, it just suggests it as a possible course of action.
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!