MATLAB: ‘str2double’ is preferred over ‘str2num

'str2num' vs. 'str2double'

Many times while writting matlab code, matlab forces to use 'str2double' function instead of 'str2num'.
I searched a lot, but could not get a convincing answer. Anyobody here has any idea?

Best Answer

MATLAB does not force one to use str2double(), but mlint may recommend it.
>> str2num('sqrt(pi)')
ans =
1.77245385090552
Did you really want people to be able to enter arbitrary text and have it executed by MATLAB ?