convert string to number array in matlab
10,685
str = '123';
num = str - '0';
% num = [1 2 3];
Author by
Admin
Updated on July 13, 2022Comments
-
Admin almost 2 years
I have a script in which a string of number is entered
string='123'
or
string='9823'
I am trying to convert this into an array of the form [a,b,c,d] e.g from a string of '123' to a numerical array [1,2,3]
Any tips on how to do this?
-
mikkola almost 8 yearsYour code produces a 1x1 double, not a 3x1 array of doubles as required.