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!