What is the difference of using ; after end?
4 ビュー (過去 30 日間)
古いコメントを表示
Hi, dear all,
For example, if I write a if loop, after end, what is the difference if I use ;?
Thanks.
0 件のコメント
採用された回答
Wayne King
2012 年 10 月 14 日
編集済み: Wayne King
2012 年 10 月 14 日
None, you don't need a semi-colon after an end statement. Putting a semi-colon in or leaving one off do not generate mlint warnings.
6 件のコメント
Walter Roberson
2012 年 11 月 7 日
The timing difference that comes to mind was on the order of a factor of 10 for the testcase that was used. As the internal mechanism that causes the issue is not well understood (at least not to us on the outside of Mathworks), it is not currently possible to predict whether the difference would scale with number of iterations or with work done in each iteration or if it was more or less a constant delay that could effectively be amortized.
その他の回答 (1 件)
Daniel Shub
2012 年 11 月 7 日
I often add a semicolon or comma after statements like "end" where they are not strictly useful so that I can easily create single line commands. This is especially true when trying to answer questions on Answers
For example, you need a semicolons/commas to make the following work
for ii = 1:10, end; ii
参考
カテゴリ
Help Center および File Exchange で Memory Usage についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!