Programming and Data Types |
Converting Characters to Numeric Values
Character arrays store each character as a 16-bit numeric value. Use the double
function to convert strings to their numeric values, and char
to revert to character representation.
name = double(name) name = 84 104 111 109 97 115 32 82 46 32 76 101 101 name = char(name) name = Thomas R. Lee
Use str2num
to convert a character array to the numeric value represented by that string.
Creating Two-Dimensional Character Arrays | Cell Arrays of Strings |