CodePudding user response:
The function B=swap_ends (A)N [M]=size (A);
B=zeros (M, N)
If N==1,
B=A;
Else,
B (:, 1: N)=A (:, [1] N 2: N - 1;
End,
CodePudding user response:
The function B=swap_ends (A)N [M]=size (A);
B=zeros (M, N)
If N==1,
B=A;
Else,
B (:, 1: N)=A (:, [N, N - 1: - 1:2 1];
end,