building a square matrix out of a vector
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everyone,
im trying to build a [n X n] matrix from a [1 n*n] vector. can anybody give me a simple code?
0 Commenti
Risposta accettata
Mischa Kim
il 8 Mar 2014
Modificato: Mischa Kim
il 8 Mar 2014
Hossein, use reshape:
A = 1:4*4;
n = sqrt(length(A)); % if A is indeed an n*n vector
B = reshape(A,n,n)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!