Concatenation, MATLAB in Mathematics

Concatenation:

The String concatenation means to join the strings altogether. Of course, as strings are merely vectors of the characters, the technique of concatenating vectors also works for the strings. For illustration, to generate one long string from the two strings, it is possible to join them by placing them in square brackets:

 

>> first = 'Bird';

>> last = 'house';

>> [first last]

ans =

Birdhouse

 

Also the function strcat does this horizontally, that means that it generates one longer string from the inputs.

>> first = 'Bird';

>> last = 'house';

>> strcat(first,last)

ans =

Birdhouse

 

There is a distinction between these two methods of concatenating, though, if there are leading or trailing blanks in the strings. The technique of using the square brackets will concatenate the strings, involving all leading and trailing blanks.

 

>> str1 = 'xxx   ';

>> str2 = '   yyy';

>> [str1 str2]

ans =

xxx      yyy

>> length(ans)

ans =

  12

 

Posted Date: 10/20/2012 5:04:33 AM | Location : United States







Related Discussions:- Concatenation, Assignment Help, Ask Question on Concatenation, Get Answer, Expert's Help, Concatenation Discussions

Write discussion on Concatenation
Your posts are moderated
Related Questions
Example of Recursive functions: This definition is recursive as a factorial is defined in terms of the other factorial. There are two parts to any recursive definition: the co

Creating string Variables: The string consists of a few numbers of characters (including, possibly, none). These are the illustrations of the strings: '' 'x' 'ca

Counting in a While Loop: Whenever it is not known ahead of the time how many values will be entered into the script, it is often essential to count the number of values which

Pie chart - plot functions: The MATLAB also has a function pie which will generate a pie chart. Calling the function with the form pie (vec) draws a pie chart, by using the pe

Illustration of Minimum and Maximum Value Both of these functions also return the index of the minimum or maximum value; when there is more than one occurrence, it returns the

Use of string variables: The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters

Function isreal - complex numbers: The function isreal returns 1 for logical true when there is no imaginary part of the argument, or 0 for false when the argument does have a

Fliplr function: The fliplr function "flips" the matrix from left to right (in another words the left-most column, the first column, become the last column and so on), and the

Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Three-Dimensional Plots: The MATLAB has many functions which will display three-dimensional plots. Most of these functions have similar name as corresponding two-dimensional p