Effacer les filtres
Effacer les filtres

What is the difference between commas and spaces for two variables in brackets on the command line?

4 vues (au cours des 30 derniers jours)
What is the difference between commas and spaces for two variables in brackets on the command line?
  1 commentaire
Stephen23
Stephen23 le 9 Déc 2022
"What is the difference between commas and spaces for two variables in brackets on the command line?"
The difference is clarity: space can easily be a mistake, commas make the intent clearer.
This is not just hypothetical, we regularly get questions on this thread caused by the OP adding extra spaces into their matrix construction. Using commas makes the intent clearer and the bug locations easier to identify.

Connectez-vous pour commenter.

Réponses (2)

Voss
Voss le 9 Déc 2022
No difference.

Matthew
Matthew le 9 Déc 2022
Previous answer is obviously correct, but if you wanted to see documentation:
In particular:
"...blank spaces act as delimiters in horizontal concatenation. When defining row vectors, you can use spaces and commas interchangeably to separate element"

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by