charConverting a numeric array to a character array
char(A)A should be a numeric array, character array, or function handle.A is a numeric array (e.g., double, logical, complex double), the entries are converted to characters.NaN are substituted by zeros, and Inf are substituted by 65535 (the maximum value of UInt16).A is the function handle of an anonymous function, the function expression is converted to a character vector.A is a handle of other function types, the function name is converted to a character vector.A is a character array or empty, A is unchanged.char(S1, S2, ..., Sn)When the array A is converted to a character array using char(), each of its rows is converted to a row of characters. In the example below, the row [55357, 56985, 32.000, 77.000, 89.000, 32.000, 67.000, 65.000, 82.000] is converted to '🚙 MY CAR'. Note that the vector before conversion has 9 entries, whereas the vector after conversion has 8. This is because the numbers 55357 and 56958 are combined to form '🚙'. From this example, we see that arrays before and after conversion may have different sizes.
a = [55357, 56985, 32.000, 77.000, 89.000, 32.000, 67.000, 65.000, 82.000];
length(a)
c = char(a)
length(c)
ans =
9.0000
c =
🚙 MY CAR
ans =
8.0000

a = [55357, 56985, 32.000, 77.000, 89.000, 32.000, 67.000, 65.000, 82.000];
b = [83.000, 79.00, 32.000, 67.00, 79.00, 79.000, 76.000, 33.000, 33.00];
char(a,b)
ans =
🚙 MY CAR
SO COOL!!