If you want the output to give the alphabetical order of the letters, 1 to 26, you can do this:
str = "ABCXYZ";
mat = char(str);
ds = double(mat) - 64
which gives
ds = 1 2 3 24 25 26
solved I want to convert a string containing letters to a double in matlab [closed]