MATLAB: String to num string to number Hi, I am reading string data of this format from a text file: (20:200,40:300) This is the area of an image which I wish to select. How do I convert this string to number range. Thanks. Charles- Best Answer Hi Charles,a simple way would be replace all non digits by spaces and use str2num afterwards:x = '(20:200,40:300)';x(~isstrprop(x, 'digit')) = ' ';xNumber = str2num(x)Titus Related SolutionsMATLAB: What is the fastest way to determine whether a string is a number Probably:isnan(str2double(str))This won't need try/catch either.Anything with eval in it will definitely not be fast. MATLAB: Largest three digit number in Matlab 9e+99?However that number cannot be represented exactly in MATLAB.9^(9^9) is another possibility but I suspect it cannot be represented exactly either.2^52 is exactly representable. A good question would be whether any values between that and 2^53-1 can be represented in 3 digits Related QuestionHow to randomly change a digit in a stringReplace numeric char within a columnSeparating string element by two and creating a vector in Simulink“randi(100)” Outputting Characters Instead of IntegersHow to convert num2str for fprintf(fid, )I need to rewrite numbers of variable to vector.
Best Answer