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

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

5 p2+8p+15, 3 p2-3p-18, 12 p2-p-30

Illustration of Labels and prompts: The program below prompts the user for endpoints (x1, y1) and (x2, y2) of a line segment, and computes the midpoint of the line segment, th

fprintf function - File function: The fprintf function really returns the number of bytes which was written to the file, therefore if you do not want to see that number, suppr

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

Plot Functions: Faraway, we have plotted to generate two-dimensional plots and bar to generate bar charts. We have seen how to clear the Figure Window by using clf, and how to

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

Using Functions with the Vectors and Matrices: As MATLAB is written to work with the vectors and matrices, the whole vector or matrix can be passed as an argument to the funct

Animation: In this part we will observe a couple of ways to animate a plot. These are visuals, therefore the outcomes can't really be shown here; it is essential to type these