Pass the input cell arrays to the strcat functionĬountry = Ĭ = strcat(Capital, Country, ', Capital-Country')Įxplanation: First, Declaring the first input character array. For this example, we will follow steps:Ģ. In this example, we will take cell arrays of characters will see how the strcat functions works. As we can see in the output, we have obtained a concatenated string of character vectors. Please note that, in 2 nd and 3 rd input strings, we have passed an extra space in the beginning of the character. Passing the input character vectors to the ‘strcat’ function. Declaring the third input character vector. Declaring the second input character vector. Input these character vectors in strcat functionĮxplanation: First, Declaring the first input character vector. Pass the required input character vectorsĢ.
For our first example, we will follow the following steps:ġ. In this example, we will learn how to concatenate character vectors.
Let us now understand the code of strcat function in MATLAB using different examples: Example #1 C = cat (dim, x, y) is used to concatenate matrix ‘x’ and matrix ‘y’ along the dimension ‘dim’. Below is the syntax for Matlab Concatenate:Įxplanation: C = strcat (st1, st2, st3, … stN) is used to concatenate the input strings horizontally.