maximizing efficiency in simple commands
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (1)
Andrei Bobrov
il 20 Ago 2013
Modificato: Andrei Bobrov
il 20 Ago 2013
ones(4,1)*x
kron(ones(4,1),x)
Categorie
Scopri di più su Data Types in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!