What is the difference between convertToString and num2str?
Show older comments
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 Comment
KSSV
on 24 Oct 2017
convertToString uses num2str inside.
Answers (1)
Jan
on 24 Oct 2017
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)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!