在MATLAB中转换float类型的数字

时间:2015-10-18 16:26:07

标签: matlab floating-point data-conversion

在我的任务中,我的编号为12.7,在septenary number system(base = 7)中表示,我需要将此编号转换为基数为11的系统。 我想我应该首先将这个数字转换为十进制系统,然后再转换为具有基数11的系统。

base1 = 7;
base2 = 11;
num = 12.3;
str_num = num2str(12.3);
num_dec = typecast(int16(base2dec(str_num,base1)), 'float');

结果我收到了错误。

??? Error using ==> base2dec at 41
String 12.3 contains characters which cannot be converted to base 7.

这个问题有解决办法吗?如何使用matlab转换这种数字(浮点数)?

0 个答案:

没有答案