Next: Searching and Replacing, Up: Strings
Create a string array from a numeric matrix, cell array, or list of
If the argument is a numeric matrix, each element of the matrix is converted to the corresponding ASCII character. For example,
char ([97, 98, 99]) => "abc"If the argument is a cell array of strings, the result is a string array with each element corresponding to one element of the cell array.
For multiple string arguments, the result is a string array with each element corresponding to the arguments.
The returned values are padded with blanks as needed to make each row of the string array have the same length.
Convert a number to a string. These functions are not very flexible, but are provided for compatibility with Matlab. For better control over the results, use
sprintf
(see Formatted Output).
This function has been deprecated. Use num2str instead.
Convert complex number to a string. Inputs
- zz
- complex number
- flg
- format flag 0 (default): -1, 0, 1, 1i, 1 + 0.5i 1 (for use with zpout): -1, 0, + 1, + 1i, + 1 + 0.5i
Return a string containing all the arguments concatenated. For example,
s = [ "ab"; "cde" ]; strcat (s, s, s) => "ab ab ab " "cdecdecde"
The value of this variable is used to pad all strings in a string matrix to the same length. It should be a single character. The default value is
" "
(a single space). For example,string_fill_char = "X"; [ "these"; "are"; "strings" ] => "theseXX" "areXXXX" "strings"
Return a matrix containing the strings s_1, ..., s_n as its rows. Each string is padded with blanks in order to form a valid matrix.
This function is modelled after Matlab. In Octave, you can create a matrix of strings by
[
s_1; ...;
s_n]
even if the strings are not all the same length.