Skip to content

char

Converting numeric array to character array

char(A)

  • If A is a numeric or logical array, A is converted to a character array using the ASCII table.
  • Entries of A should be ASCII code values (0 - 127).
  • If A is a character array or empty, A is unchanged.
  • Non-printable characters (ASCII values 0 - 32) are displayed as white-spaces.

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

  • Concatenating character arrays S1, S2, ..., Sn vertically.
  • If an input argument is multi-dimensional, it is first reshaped to a matrix (i.e., 2D array) before concatenation.
  • If S1, S2, ..., Sn have different widths after reshaping, the reshaped arrays are padded with trailing white-spaces to match sizes.
  • If an input argument is a numeric array, it should only contain ASCII code values (0 - 127).
  • Non-printable characters (ASCII values 0 - 31) are displayed as white-spaces.