MATLAB: How to flip a row vector without using flip(lr) function

flipfliplrrow vector

I want to write a function that it can flip a row vector without flip(lr) function.
if true
% A=[1 2 -3 4]
And output must be:
B=[4 -3 2 1]
end

Best Answer

Reverse the indices:
A = [1 2 -3 4];
B = A(numel(A):-1:1)
B =
4 -3 2 1