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

Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

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

Indexed empty matrix: The Individual elements cannot be eliminated from matrices, as matrices always have the similar number of elements in every row. >> mat = [7 9 8; 4 6

Strings as Vectors: The Strings are considered as vectors of characters-or in another words, a vector in which each and every element is a single character-so numerous vector

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

Writing and Reading Spreadsheet Files: The MATLAB functions xlswrite & xlsread will write to and read from the spreadsheet files which have the extension .xls. For illustratio

User-defined functions: Therefore, although many functions compute and return values, some do not. A few functions rather merely accomplish a task. Regardless of what type of

Strcat function - Concatenation : The strcat function, though, will eliminate the trailing blanks from strings before concatenating. Note that in these illustrations, the trail

Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2