MATLAB: How to convert char into double

charconvertdoubleMATLAB

Hello everyone,
I have following char: "2.311.592 /" And I want to convert it to double and leave numbers only, I have tried to use
new = str2double(val);
But the output was NaN, what would you recommend me to do?

Best Answer

Str = '2.311.592 /';
Str(Str < '0' | Str > '9') = [];
Value = sscanf(Str, '%d');