Splitting a vector into a matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
stavros boutsikos
el 17 de Nov. de 2020
Editada: James Tursa
el 17 de Nov. de 2020
i have a 16x1 vector
0.5892
-3.8318
0.0591
-3.6984
-0.4266
-0.1333
0.5892
0
-0.0266
0.1608
0.3500
0
0.3322
0.0039
0
0
i want the odd nth terms(1st 3rd 5th 7th 9th 11th 13th 15th) to go in the first column and the even nth terms(2nd 4th 6th 8th 10th 12th 14th 16th) to go in the second column. How can i do this?
0 comentarios
Respuesta aceptada
James Tursa
el 17 de Nov. de 2020
Editada: James Tursa
el 17 de Nov. de 2020
result = [x(1:2:end) x(2:2:end)];
or
result = reshape(x,2,[]).';
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!