maximizing efficiency in simple commands
이전 댓글 표시
I have an array given by
x = [1 2 3 4];
I would like to create a matrix that looks like
M = [1 2 3 4;
1 2 3 4;
1 2 3 4;
1 2 3 4];
What's the most computationally efficient way to create M from x?
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2013년 8월 20일
편집: Andrei Bobrov
2013년 8월 20일
ones(4,1)*x
kron(ones(4,1),x)
카테고리
도움말 센터 및 File Exchange에서 Data Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!