Use of string variables, MATLAB in Mathematics

Use of string variables:

The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters which cannot be printed, but complete a task (like backspace or tab). The Whitespace characters involve the tab, space, newline (that moves the cursor down to the next line), and carriage return (that moves the cursor to the starting of the present line). The Leading blanks are blank spaces at the starting of a string, for illustration, 'hello', and trailing blanks are the blank spaces at end of a string.

There are some ways that the string variables can be formed. The one is using an assignment statement which is as shown below:

>> word = 'cat';

 

The other method is to read into the string variable. Recall that to read into the string variable by using the input function, the second argument 's' should be involved:

>> strvar = input('Enter a string: ', 's')

Enter a string: xyzabc

strvar =

xyzabc

 

If leading or trailing blanks are typed by the user, then these will be stored in the string. For illustration, in the following the user entered four blanks and then 'xyz':

>> s = input('Enter a string: ','s')

Enter a string:     xyz

s =

xyz

Posted Date: 10/20/2012 4:29:11 AM | Location : United States







Related Discussions:- Use of string variables, Assignment Help, Ask Question on Use of string variables, Get Answer, Expert's Help, Use of string variables Discussions

Write discussion on Use of string variables
Your posts are moderated
Related Questions
5 p2+8p+15, 3 p2-3p-18, 12 p2-p-30

Use of string variables: The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters

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

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

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

Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

Example of Symbolic Expression When there is more than one variable, the MATLAB selects which to solve for. In the illustration below, the equation ax 2 + bx = 0 is solved. Th

Blanks function: The blanks function will generate a string consisting of n blank characters-that are kind of hard to see here! Though, in a MATLAB if the mouse is moved to hi

Writing variables to a File: The save command is used to write variables to a file, or to append the variables to a MAT-file. By the default, save function writes to a MAT-fil

Illustration of Writing to files: Here is the other illustration in which a matrix is written to a file. At First, an arbitrary 2 × 4 matrix is generated, and then it is writt