How to use str2num(), fliplr(), and num2str() In MATLAB
The num2str() function is used to convert the specified numbers to a character array.
Syntax: num2str(num)
Parameters: This function accepts a parameter.
- num: This is the specified number.
Example:
Matlab
% MATLAB code for reversing a specified number % using the combination of str2num(), fliplr() % and num2str() % Specifying a number to reverse Number = 2468 % Calling the combination of three functions % str2num(), fliplr(), and num2str() % over the above number to reverse Reversed_Number = str2num(fliplr(num2str(Number))) |
Output:
Number = 2468 Reversed_Number = 8642
How to reverse a number in MATLAB?
In this article, we will discuss the âReversing of a numberâ in MATLAB that can be done using the multiple methods which are illustrated below.
Contact Us