Creating customized strings, MATLAB in Mathematics

Creating Customized strings:

There are many built-in functions which create customized strings, including blanks, char, and sprintf.

We know that the char function can be used to convert from an ASCII code to character, as the illustration shows:

>> char(97)

ans =



A char function can also be used to generate a matrix of characters. Whenever using the char function to generate a matrix, it will automatically pad the strings within the rows with blanks as essential so that they are all of similar length, just like the strvcat.


>> clear greetmat

>> greetmat = char('Hello','Goodbye')

greetmat =



>> size(greetmat)

ans =

2  7

Posted Date: 10/20/2012 5:06:43 AM | Location : United States

Related Discussions:- Creating customized strings, Assignment Help, Ask Question on Creating customized strings, Get Answer, Expert's Help, Creating customized strings Discussions

Write discussion on Creating customized strings
Your posts are moderated
Related Questions
Three-dimensional pie and bar: For the bar3 function, x & y vectors are passed and the function displays three-dimensional bars as shown in figure: Figure: Three-dimen

Labels and Prompts: The script loads all the numbers from file into a row vector. It then splits the vector; it stores the initial element that is the experiment number in a v

Error-Checking for Integers: As MATLAB uses the type double by default for all the values, to check to make confirm that the user has entered an integer, the program have to c

sprintf function: The sprintf function works precisely like the fprintf function, but rather than printing it generates a string. Here are some illustrations in which the outp

Referring to and Modifying the Matrix Elements: To refer to matrix elements, the row and then the column indices are given in parentheses (always the row index initially and t

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

Differentiation: The derivative of a function y = f(x) can be written as follows or f  '(x) and is defined as the rate of change of the dependent variable y with respe

Sorting The Sorting is a process of putting a list in order; either in descending (maximum to minimum), or ascending (minimum to maximum) order. For illustration, here is a li

Symbolic Expression The solve function solves an equation and returns the solution(s) as symbolic expressions. The answer can be converted to numbers by using any numeric funct

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.