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?

This project requires you to use the ideas of Chapter 25 regarding maximization of a function. Here we assume that evolution has acted to generate highly efficient foragers. By hig

Structure Consisting of the Fields A MATLAB can also solve the sets of equations. In this illustration, the solutions for x, y, & z are returned as a structure consisting of th

Refer the subset of a matrix: It is also possible to refer to the subset of a matrix. For illustration, this refers to the first & second rows, second & third columns: >> m

Illustration of Advanced file input and output: For illustration, to refer to the third number in the first element of the cell array: >> subjdata{1}(3) ans =

Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2

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

Built-in function for Differentiation: The MATLAB has a built-in function, diff that returns the differences between consecutive elements in a vector. For illustration, >>

Built in recursive function in MATLAB: We have seen that the built-in function in MATLAB to compute factorials, termed as the factorial and we know how to implement the iterat

Function xlsread - file function: The function xlsread will read from the spreadsheet file. For illustration, to read from file just generated: >> ssnums = xlsread('ranexc