could anyone help me how to pair the numbers in the desired manner as shown below
Mostrar comentarios más antiguos
A=1:16
R = reshape(A,4,[])
After executing the above command results in
R =
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16
Now I want to group the numbers in the desired manner
1 2 3 4 5 6 7 8
12 11 10 9 16 15 14 13
Could anyone please help me on this.
Respuesta aceptada
Más respuestas (1)
Yongjian Feng
el 2 de Nov. de 2021
0 votos
reshape(A, 8, 2)'
2 comentarios
Dyuman Joshi
el 2 de Nov. de 2021
This doesn't give the correct output
Yongjian Feng
el 2 de Nov. de 2021
Whoops. Didn't pay attention to the order of the second row.
Then we need to use flip most likely.
A=1:16
R = reshape(A,4,[]);
R(:, 3) = flip(R(:, 3));
R(:, 4) = flip(R(:, 4));
ret = reshape(R, 8, 2)'
Categorías
Más información sobre Multirate Signal Processing 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!