This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Data Type Conversion

Converting between numeric arrays, character arrays, cell arrays, structures, or tables


char Convert to character array
cellstr Convert to cell array of character vectors
int2str Convert integers to character array
mat2str Convert matrix to character vector
num2str Convert numbers to character array
str2double Convert string to double precision value
str2num Convert character array to numeric array
native2unicode Convert numeric bytes to Unicode character representation
unicode2native Convert Unicode character representation to numeric bytes
base2dec Convert text representing number in base N to decimal number
bin2dec Convert text representation of binary number to decimal number
dec2base Convert decimal number to character vector representing base N number
dec2bin Convert decimal number to character vector representing binary number
dec2hex Convert decimal number to character vector representing hexadecimal number
hex2dec Convert text representation of hexadecimal number to decimal number
hex2num Convert IEEE hexadecimal string to double-precision number
num2hex Convert singles and doubles to IEEE hexadecimal strings
table2array Convert table to homogeneous array
table2cell Convert table to cell array
table2struct Convert table to structure array
array2table Convert homogeneous array to table
cell2table Convert cell array to table
struct2table Convert structure array to table
cell2mat Convert cell array to ordinary array of the underlying data type
cell2struct Convert cell array to structure array
mat2cell Convert array to cell array with potentially different sized cells
num2cell Convert array to cell array with consistently sized cells
struct2cell Convert structure to cell array

Examples and How To

Convert from Character Arrays to Numeric Values

This summary details how to convert character arrays to numeric values.

Convert from Numeric Values to Character Array

This summary details how to convert numeric values to character arrays.


Valid Combinations of Unlike Classes

If you include elements of unlike classes in a matrix, MATLAB® converts some elements so that all elements of the resulting matrix are of the same type. Data type conversion is done with respect to a preset precedence of classes.

Was this topic helpful?