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
Discuss the frequency range / radiation angles at which the two models diverge, and relate this divergence to your understanding of the behaviour of a pistonic source. Compare t

Hello! How to cipher on Matlab the message consisting eight symbols. At first the message shares on blocks. Then in each of blocks shift of symbols is carried out. The initial text

write matlab program for Cubic Spline Sweep Surface

Find the boundary between each two of the equations P1, P2, P3 by solving: P1 = P2  ,  P1 = P3  ,  P2 = P3 Plot the boundary lines on a single figure that also includes the

In many applications, including ?nancial mathematics, ?nding zeros of a function f(x) = 0 (4) is paramount. One of the simplest method is the Bisection Method. The bisection

how to write the national log (ln(x)) in matlap ?

Write a MATLAB program (using/making the necessary functions that you deem necessary) that does the two following jobs: It generates the following digital modulation schemes. In

Need help programming in Matlab for airy equations

256789;267825;625892;982895;598289

Generates sin or cos wave using plot functions: The script generates an x vector; iterating through all the values from 0 to 2*π in steps of 2*π /40 gives sufficient points to