Functions with outputs not separated by commas
3 ビュー (過去 30 日間)
古いコメントを表示
From documentation, I read that multiple outputs for functions should be enclosed in square brackets and separated by commas. However, there are some functions which have declared some outputs is square brackets but the outputs are not separated by commas i.e. they are just separated by an empty space. What would be the reason behind such cases?
0 件のコメント
回答 (2 件)
Stephen23
2018 年 6 月 23 日
編集済み: Stephen23
2018 年 6 月 23 日
The two are essentially equivalent. But using space characters is not recommended, because it is much easier to make mistakes and makes debugging those mistakes harder. Use commas.
Discussions on why using commas is preferred:
Information on comma-separated lists:
Summary: Using commas is preferred because it unambiguously shows the separation between each element. This applies equally to all comma-separated lists: input arguments, output arguments, concatenation, etc.
0 件のコメント
Image Analyst
2018 年 6 月 23 日
Which documentation item did you see that in? My guess is that they just overlooked some documentation, or examples in the documentation, when they were putting the commas in. The recommendation is to use commas after parameters.
Personally, I also like to add a space after the comma, and on either side of an equal sign, colon, or mathematical operator, but that's a matter of style.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!