% CAT(2,A,B) is the same as [A,B].
% CAT(1,A,B) is the same as [A;B].
似乎我需要知道这一点,以了解cat
的作用。
答案 0 :(得分:3)
[A,B]
是通过将B放在A的右边而形成的矩阵,而
[A;B]
是通过将B置于A下而形成的矩阵。
还要了解horzcat
和vertcat
。
答案 1 :(得分:3)
[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即可看到差异