how do i write a function that splits a 16x1 matrix into a 4x4 matrix
Mostrar comentarios más antiguos
how do i write a function that splits a 16x1 matrix into a 4x4 matrix
Respuestas (2)
Image Analyst
el 5 de Sept. de 2013
out4x4 = reshape(vector16x1, [4, 4])
Youssef Khmou
el 5 de Sept. de 2013
Use reshape as mentioned by @Image Analyst , or use standard method :
function Y=split16144(X)
Y=zeros(4,4);
ctr=1;
for x=1:4
for y=1:4
Y(x,y)=X(ctr);
ctr=ctr+1;
end
end
1 comentario
James Tursa
el 5 de Sept. de 2013
Equivalent to
reshape(vector16x1, [4, 4]).'
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!