Swap the First and Last Column (CODY)

4 次查看(过去 30 天)
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).

回答(1 个)

KSSV
KSSV 2021-6-7
A = rand(1,5) ;
A([1 end]) = A([end 1])

类别

Help CenterFile Exchange 中查找有关 Dynamic System Models 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by