What is the difference between convertToString and num2str?

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.

Answers (1)

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

Asked:

on 24 Oct 2017

Answered:

Jan
on 24 Oct 2017

Community Treasure Hunt

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

Start Hunting!