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.
想象一个矩阵:
a = 4 2 8 9
我需要重复n次。如果n = 3,结果是:
n = 3
a = 4 4 4 2 2 2 8 8 8 9 9 9
你可以试试:
n = 3; reshape(repmat(a', n, 1), numel(a)*n, 1)
尝试使用 kron 函数,newMatrix = kron(a,ones(1,4))