Shifting the first element of an array to the end
46 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dillon La
el 6 de Sept. de 2021
Comentada: Dillon La
el 6 de Sept. de 2021
Hi all, I.m trying to transform vector A into B as below,
A B
[ 1 2 3 4 ] [ 4 1 2 3 ]
Here is what I have got so far, but it didnt work out, please point out where I got it wrong
A = [1 2 3 4];
B = [A(1)];
for i = [2:length(A)]
B = [A(i) B]
end
disp(B);
0 comentarios
Respuesta aceptada
Más respuestas (1)
Ver también
Categorías
Más información sobre Loops and Conditional Statements 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!