Convert Number Bases

版本 1.0.0.0 (3.5 KB) 作者: Bob Kagy
Convert from any numerical base and encoding to any other, even for large numbers.
2.4K 次下载
更新时间 2004/12/6

无许可证

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.

引用格式

Bob Kagy (2024). Convert Number Bases (https://www.mathworks.com/matlabcentral/fileexchange/6462-convert-number-bases), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R13SP1
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Numbers and Precision 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0