MATLAB: NaN from str2double(‘1 2 3’) on Matlab 2020a

MATLABstr2doublr

Hi
str2double('1 2 3') returns NaN on Matlab 2020a but works fine on Matlab 2018b & Matlab 2016b (returns: 1 2 3).
How to convert a string of numbers to numbers in the newest Matlab version?
Best,
Dawid

Best Answer

"works fine on Matlab 2018b"
Are you sure?
>> version
ans =
'9.5.0.1298439 (R2018b) Update 7'
>> str2double('1 2 3')
ans =
NaN
>> str2num('1 2 3')
ans =
1 2 3
>>