I have a script in which a string of number is entered
string=\'123\'
or
string=\'9823\'
I am trying to
use the function str2num()
str = '123';
str = str2num(str);
Note: To verify that i'm correct, type in 'whos str' in the command window, and check the class. A string has a class, char, and numeric values have a class, double
You can use cellstr:
cellstr('123')
ans =
{
[1,1] = 123
}
str = '123';
num = str - '0';
% num = [1 2 3];