By using fliplr() function
The fliplr() function is used for flipping the specified row vector’s elements.
Syntax:’
fliplr(A)
Here, fliplr(A) function is used to return a vector with reversed elements of the same length of the specified row vector “A”.
Example 1:
Matlab
% MATLAB code for fliplr() % Initializing a row vector v = 10:20 % Calling the fliplr() function % over the above vector "v" to % reverse its elements fliplr(v) |
Output:
Example 2:
Matlab
% MATLAB code for fliplr() % Initializing a 2*2 cell % array of characters A = { 'a' 'b' ; 'c' 'd' } % Calling the fliplr() function % over the above cell array "A" to % reverse its elements fliplr(A) |
Output:
How to inverse a vector in MATLAB?
In this article, we are going to discuss the “Inversion of a vector” in MATLAB which can be done in three different approaches that are illustrated below:
Contact Us