MATLAB Function Reference | Search  Help Desk |
strings | Examples See Also |
S = 'Any Characters'
S = string(X)
X = numeric(S)
S = 'Any Characters'
is a vector whose components are the numeric codes for the characters (the first 127 codes are ASCII). The actual characters displayed depend on the character set encoding for a given font. The length of S
is the number of characters. A quote within the string is indicated by two quotes.
S = string(X)
can be used to convert an array that contains positive integers representing numeric codes into a MATLAB character array.
X = double(S)
converts the string to its equivalent numeric codes.
isstr(S)
tells if S
is a string variable.
Use the strcat
function for concatenating cell arrays of strings, for arrays of multiple strings, and for padded character arrays. For concatenating two single strings, it is more efficient to use square brackets, as shown in the example, than to use strcat
.
s = ['It is 1 o''clock', 7]
char
Create character array (string)
strcat
String concatenation