Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要转换一个矩阵:
X = [1 2; 3 4] X = 1 2 3 4
到
X = [1 2; 1 2; 1 2; 3 4; 3 4; 3 4] X = 1 2 1 2 1 2 3 4 3 4 3 4
并对具有任意行数的矩阵执行此操作。如何在 MATLAB 中实现这一点?
这是使用 kron 执行此操作的好方法
kron(X,[1 1 1]')
这会产生
1 2 1 2 1 2 3 4 3 4 3 4