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

 

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 =

Hello

Goodbye

>> 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
Nested IF-ELSE statements: The if-else statement is used to select between the two statements. In order to select from more than two statements, the if-else statements can als

Standard Deviation The standard deviation is the square root of variance: The built-in function in a MATLAB for the standard deviation is known as std; the standard dev

Polar Form: Any complex number z = a + bi can be thought of as a point (a,b) or vector in the complex plane in which the horizontal axis is the real part of z, and the vertica

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

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

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

how can reconstruct just part of an image using imreconstruct?

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 =

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

Find Minimum and Maximum for each row To find the maximum (or minimum) for each row, the dimension of 2 (that is how a MATLAB refers to rows) can be identified as the third arg