What does the symbol ";" mean in the statement "p1 = [x; y]"?
1 次查看(过去 30 天)
显示 更早的评论
What does the symbol ";" mean in the following statement?
p1 = [x; y];
0 个评论
采纳的回答
Friedrich
2012-2-15
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 个评论
Jan
2012-2-15
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]
更多回答(1 个)
k.v.swamy
2012-2-15
hi, p1 = [x; y]; means u r combining the vectors x and y in to a single vector p1.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!