Reverse order of elements
How to get the reverse order of elements in a vector.
fliplr Flip left to right
reverse order of a numerical vector
>> v = [1,2,3];
>> fliplr(v)
3 2 1
reverse order of strings (cell array)
>> s = {'A','B','C'};
>> fliplr(s)
'C' 'B' 'A'
flipud Flip up to down
>> s = {'A';'B';'C'};
>> flipud(s)
'C'
'B'
'A'
Index backwards to get inverse order
>> s = {'A','B','C'};
>> s(end:-1:1)
'C' 'B' 'A'
read more
read more