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 =



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 =


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
Labels and Prompts: The script loads all the numbers from file into a row vector. It then splits the vector; it stores the initial element that is the experiment number in a v

Example of Logical built-in functions: For equivalent to all the function, we should make sure that the entire elements in the vector are logically true. The one way of doing

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

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 =

Creating string Variables: The string consists of a few numbers of characters (including, possibly, none). These are the illustrations of the strings: '' 'x' 'ca

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

Write a MATLAB function [d1, u1, l1, c1, r1] = NaiveGaussArrow(d, u, l, c, r) that takes as input the 5 vectors de ned above representing A. This function performs Naive Gauss redu

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

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

Program of built-in factorial function: Calling this function yields similar result as the built-in factorial function: >> fact(5) ans =   120 >> factorial(