Hi all, I would like to convert a vector
A = [1,2,3,4,5,6]
to
matrix like that:
B=
[1 2 3,
4 5 6]
I tried to use reshape and I don't have vec2mat function. Do you have an idea? thank you

 Respuesta aceptada

Star Strider
Star Strider el 31 de Oct. de 2018

0 votos

Try this:
A = [1,2,3,4,5,6];
B = reshape(A(:), 3, []).'
B =
1 2 3
4 5 6

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 31 de Oct. de 2018

Respondida:

el 31 de Oct. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by