Convert Number Bases
No License
Convert from any base and encoding to any other base and encoding.
Base: Base 2, Base 10, Base 16, Base 64
The number of symbols used to represent a value.
Encoding: The symbols used to represent the value of a digit in a particular place.
Examples:
Base 10 Decimal to Base 16 Hexadecimal:
cnvbase('76','0123456789','0123456789ABCDEF') = '4C'
Base 10 to Base 255:
cnvbase('8745','0123456789',[0:255]) = [34 41]
The algorithm for converting from one base to another does not rely on converting the input to a single float, thus avoiding precision problems with integers greater than 2^53.
Cite As
Bob Kagy (2024). Convert Number Bases (https://www.mathworks.com/matlabcentral/fileexchange/6462-convert-number-bases), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |