What is the difference between convertToString and num2str?
2 次查看(过去 30 天)
显示 更早的评论
I would like to understand the difference between the two functions "convertToString" and "num2str". I have used both to convert a double value to a string so that it can be displayed using the "disp" function.
I have checked the Matlab documentation, and the "convertToString" function does not seem to be included.
Hopefully somebody can enlighten me as to the differences.
回答(1 个)
Jan
2017-10-24
As you have found out already, convertToString() is not a documented function of Matlab. I do not even know this function. So please explain, where you find it:
which convertToString
Either it is not documented, or defined by a user. Maybe the output is an object of the new String class:
s = convertToString(1)
class(s)
while num2str creates a char vector
s = num2str(1)
class(s)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!