Illustration of input function, MATLAB Programming

Illustration of Input function:

For illustration,

>> rad = input('Enter the radius: ')

Enter the radius: 5

rad = 5

If character or string input is preferred, 's' should be added after the prompt:

>> letter = input('Enter a char: ','s')

Enter a char: g

letter =

g

Note that though this is a string variable, the quotes are not shown. Though, they are shown in the Workspace Window.

If the user enters only spaces or tabs before pressing an Enter key, they are ignored and the empty string is stored in the variable:

>> mychar = input('Enter a character: ', 's')

Enter a character:

mychar =

''

Note that in this case the quotes are shown, to elaborate that there is nothing inside of the string.

Though, if the blank spaces are entered before other characters, they are involved in the string. In this illustration, the user pressed the space bar four times before entering the 'go':

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

Enter a string:     go

mystr =

  go

>> length(mystr)

ans =

 

Posted Date: 10/18/2012 5:48:15 AM | Location : United States







Related Discussions:- Illustration of input function, Assignment Help, Ask Question on Illustration of input function, Get Answer, Expert's Help, Illustration of input function Discussions

Write discussion on Illustration of input function
Your posts are moderated
Related Questions
Input in a for Loop: The script below repeats the process of prompting the user for a number, and echo printing the number (that means simply printing it back out). A for loop

An FIR filter has coefficients b = [ 1.0000   -0.6387    1.0214    0.8210   -0.7470    1.0920 ] (a) Find H(z) for the filter and plot its frequency response (magnitude and phase

I am doing project "Recognizing people in video based on their body" the system will use MATLAB to detect people based on thier body and then recognize them from their clothes "us


Obtaining the Partial Fraction Expansion of the Z-Transform expression and to find its Inverse Z-Transforms using MATLAB

Illustration of modifying the matrix elements: If a single index is used with the matrix, the MATLAB unwinds the matrix column by column. For illustration, for the matrix intm

Illustration of script Documentation: For illustration, the script to compute the area of a circle could be modified to have comments: The first comment at the startin

Size function - Dimensions of matrix: For the matrix mat shown next, it has three rows and two columns, therefore the size is 3 × 2. The length is the larger dimension that is

In this lab, we study the three concepts. Vector is used to store more than one value into single variable. It is similar to array (other programming language). Script is a collect

1. Design a suitable phase-lead controller. You should explain in detail how your design has been developed. Your solution should include Bode plots constructed both manually and