convert string to number array in matlab

Solution 1:

str = '123';
num = str - '0';
% num = [1 2 3];