Matrix-Number Conversion

版本 1.0.0.0 (1.3 KB) 作者: Aman Siddiqi
2 files. Matrix to number & number to matrix conversion.
1.5K 次下载
更新时间 2007/5/11

无许可证

matrix2num([1,0,0]) yields 100,
assumes base 10.
matrix2num([1,0,0],2) yields 4,
using base 2.
bases 2-10 only, otherwise NaN.
matrix2num([1,0,0],2,'on')
Activates rounding safety.
Because of the floating point
rounding error numbers w/more
than 16 digits will output as
NaN with this feature on.
Default is off.

num2matrix('1234') yields [1,2,3,4]
num2matrix('1234',2) yields [1,2;3,4]
Enter # of cols if you wish to limit
The characters will wrap to next row
The number is inputed as a string,
so you can convert digits like 0010,
It will yield [0,0,1,0]

引用格式

Aman Siddiqi (2024). Matrix-Number Conversion (https://www.mathworks.com/matlabcentral/fileexchange/7264-matrix-number-conversion), MATLAB Central File Exchange. 检索来源 .

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

Community Treasure Hunt

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

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

correction