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
How do I write a product series running from i to n of x''s using a for loop?

Illustration of logical built-in functions: The function find returns the indices of a vector which meet certain criteria. For illustration, to find all the elements in a vect

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

Illustration of Writing variables to a file: For illustration, in the below session in the Command Window, 3 variables are generated; these are then exhibited using who. Then,

Example of Symbolic Expression When there is more than one variable, the MATLAB selects which to solve for. In the illustration below, the equation ax 2 + bx = 0 is solved. Th

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

Script a MATLAB program which meets the following speci cations: The program expects an input of a two-variable real-valued continuous function f : R^2--> R The program is to cal

Illustration of Spreadsheet Files: This reads the numbers in a double vector variable nums and the text in a cell array txt (the xlsread function forever returns the numbers f

bar and barh functions: For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown: rm = randint(2,4,[1

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