What does the symbol ";" mean in the statement "p1 = [x; y]"?

1 vue (au cours des 30 derniers jours)
Manoj Murali
Manoj Murali le 15 Fév 2012
Modifié(e) : dpb le 13 Oct 2013
What does the symbol ";" mean in the following statement?
p1 = [x; y];

Réponse acceptée

Friedrich
Friedrich le 15 Fév 2012
Hi,
this means x and y are combined vertically to a new vector. So p1 = [x;y] creates a vector
p1 = (x)
(y)
Or simply try it with an example
p1 = [1;2]
  3 commentaires
Andrei Bobrov
Andrei Bobrov le 15 Fév 2012
yes
Jan
Jan le 15 Fév 2012
Horizontal concatenation: [a, b], or [a b] or cat(2, a, b) or horzcat(a, b)
Vertical concatenation: [a; b], cat(1, a, b), vertcat(a, b)
Another method, which is prone to errors is using the line break as separator:
[a
b]

Connectez-vous pour commenter.

Plus de réponses (1)

k.v.swamy
k.v.swamy le 15 Fév 2012
hi, p1 = [x; y]; means u r combining the vectors x and y in to a single vector p1.

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by