Character array
A character array is a sequence of characters, just as a numeric array is a sequence of numbers. A typical use is to store a short piece of text as a row of characters in acharacter vector。
You can create a character vector using single quotation marks.
C ='Hello, world'
C = 'Hello, world'
If you have an array of a different data type, you can convert it to a character array using thechar
function, described below.
converts the arraysC
= char(A1,...,An)A1,...,An
into a single character array. After conversion to characters, the input arrays become rows inC
。Thechar
function pads rows with blank spaces as needed. If any input array is an empty character array, then the corresponding row inC
is a row of blank spaces.
The input arraysA1,...,An
cannot be string arrays, cell arrays, or categorical arrays.
A1,...,An
can be of different sizes and shapes.
cellstr
|convertCharsToStrings
|convertStringsToChars
|double
|iscellstr
|ischar
|isstring
|string