Swap the First and Last Column (CODY)

1 vue (au cours des 30 derniers jours)
Saviyo Therattil
Saviyo Therattil le 7 Juin 2021
Réponse apportée : KSSV le 7 Juin 2021
function B = swap_ends(A)
X = A(:,end);
C = A(:,1);
A(:,1) = X;
A(:,end) = C;
B = A;
end
How do I reduce it into a length of 7? (Top length is 7).

Réponses (1)

KSSV
KSSV le 7 Juin 2021
A = rand(1,5) ;
A([1 end]) = A([end 1])

Catégories

En savoir plus sur Dynamic System Models dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by