Does anybody know?
7 次查看(过去 30 天)
显示 更早的评论
A line of code i could use for my function so when i insert a vector such as [1 2 3 4], the function i am making see's it as the value 1234(one thousand, two hundred and thirty four) instead? Thanks :)
采纳的回答
Walter Roberson
2012-3-5
str2double(sprintf('%d',V))
or
str2double(char(V+'0'))
which should be more efficient.
Warning: if your vectors might have 15 to 19 elements, then there would be additional work involved in order to get the correct integer. From 19 elements up, only an approximation of the integer can be produced.
9 个评论
Walter Roberson
2012-3-7
If you need to handle more than 19 elements, then you are going to have to write a whole new function based on very different computation principles. I think it likely that it was intended that you use those computation principles right from the beginning.
Your algorithm will need to implement "long division" or the equivalent.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!