matlab - how to put The main diameter in magic(9) with diag in a matrix 3 * 3? -


this code,i want put result of diag in matrix 3*3 in matlab,how create it?

a=magic(9); b=diag(a); 

i want put result of b in matrix 3*3

you can reshaping array:

c=reshape(b,3,3) 

Popular posts from this blog