join

Combine strings.

📝 Syntax

  • res = join(str)

  • res = join(str, delimiter)

  • res = join(str, dim)

  • res = join(str, delimiter, dim)

📥 Input argument

  • str - a string, string array or cell of strings.

  • delimiter - a string, string array or cell of strings:Characters used to separate and join strings.

  • dim - positive integer: Dimension along which to join strings.

📤 Output argument

  • res - a string, string array or cell of strings.

📄 Description

res = join(str) combines the elements ofstr into a single text by joining them with a space character as the default delimiter.

The input,str, can be either a string array or a cell array of character vectors. The output,res, has the same data type as str.

Ifstr is a 1-by-N or N-by-1 string array or cell array,res will be a string scalar or a cell array containing a single character vector.

Ifstr is an M-by-N string array or cell array, res will be an M-by-1 string array or cell array.

For arrays of any size, join concatenates elements along the last dimension with a size greater than 1.

res = join(str, delimiter) joins the elements ofstr using the specified delimiter instead of the default space character.

If delimiter is an array of multiple delimiters, andstr has N elements along the joining dimension, delimiter must have N–1 elements along the same dimension. All other dimensions of delimiter must either have size 1 or match the size of the corresponding dimensions ofstr.

res = join(str, dim) combines the elements ofstr along the specified dimension dim.

res = join(str, delimiter, dim) joins the elements ofstr along the specified dimensiondim, using delimiter to separate them.

💡 Example

🔗 See also

append, strcat.

🕔 History

Version
📄 Description

1.10.0

initial version

Last updated

Was this helpful?