[TOC]

char

Converting a numeric array to a character array

Usage

char(A)

char(S1, S2, ..., Sn)

Unicode Characters

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.

Input
a = [55357, 56985, 32.000, 77.000, 89.000, 32.000, 67.000, 65.000, 82.000];
length(a)
c = char(a)
length(c)
Output
ans = 
 9.0000

c = 
🚙 MY CAR

ans = 
 8.0000

Example

doubleToCharError

Input
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)
Output
ans = 
🚙 MY CAR 
SO COOL!!