% CAT(2,A,B) is the same as [A,B].
% CAT(1,A,B) is the same as [A;B].
看来我需要了解这个才能理解 cat
命令的作用。
[A,B]
将B放在A的右侧形成一个矩阵,而
[A;B]
矩阵是将B放在A下方形成的。
还要了解 horzcat
和 vertcat
。
[A, B] does col cat
[A; B] does row cat
例如:
x = [1, 2, 3];
y = [7, 8, 9];
[x, y] == > [1, 2, 3, 7, 8, 9]
becomes a 1x6 array
[x; y] == > [1, 2, 3]
[7, 8, 9]
becomes a 2x3 array
在Matlab中尝试一下,打开ans查看差异即可。