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
Strings as Vectors: The Strings are considered as vectors of characters-or in another words, a vector in which each and every element is a single character-so numerous vector

Dimensions - matrix: The size and length functions in the MATLAB are used to find array dimensions. Length function returns the number of elements in the vector. The size func

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

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

Logical Vectors: The relational operators can also be used with the vectors and matrices. For illustration, let's say that there is a vector, and we want to compare each eleme

Illustration of Standard Deviation The less spread out the numbers are, therefore smaller the standard deviation will be, as it is a way of determining the spread of the data.

Writing and Reading Spreadsheet Files: The MATLAB functions xlswrite & xlsread will write to and read from the spreadsheet files which have the extension .xls. For illustratio

Types of User-defined Functions: We know how to write a user-defined function, stored in an M-file, which computes and returns one value. This is merely one type of the functi

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

Writing to Files: There are many lower level functions which can write to files. We will focus on the fprintf function that can be used to write a file and also to append to a