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
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

Illustration of nested function: The output arguments are distinct from variables. The scope of an output argument is merely the nested function; and it cannot be used in the

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

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

Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

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

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


Three-Dimensional Plots: The MATLAB has many functions which will display three-dimensional plots. Most of these functions have similar name as corresponding two-dimensional p

Applications of Customized Strings: Labels, Prompts, Arguments to Functions: The one of very useful application of this is to involve numbers in strings that are used to plot