MATLAB: How to convert a string to a double precision decimal number without losing the leading zeros

data type conversionstr2double

Hi, I am trying to convert a string to a double precision number using str2double.
Since my string has leading zeros, i.e., '-0,01298784', when I convert it to double, it comes like -1298784. How can I make sure the leading zeros are still there after conversion?
Notice that is I don't know beforehand how many zeros are there, so it may vary.
Thank you.

Best Answer

Is the comma in the string meant to be a decimal point? E.g.
s = '-0,01298784'
s(s==',') = '.'
str2double(s)