Navigation

Operators and Keywords

Function List:

C++ API

: char (x)
: char (x, …)
: char (s1, s2, …)
: char (cell_array)

Create a string array from one or more numeric matrices, character matrices, or cell arrays.

Arguments are concatenated vertically. The returned values are padded with blanks as needed to make each row of the string array have the same length. Empty input strings are significant and will concatenated in the output.

For numerical input, each element is converted to the corresponding ASCII character. A range error results if an input is outside the ASCII range (0-255).

For cell arrays, each element is concatenated separately. Cell arrays converted through char can mostly be converted back with cellstr. For example:

char ([97, 98, 99], "", {"98", "99", 100}, "str1", ["ha", "lf"])
  ⇒ ["abc    "
      "       "
      "98     "
      "99     "
      "d      "
      "str1   "
      "half   "]

See also: strvcat, cellstr.

Package: octave