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
I want to write a function in matlab which gives me a population pyramid bar chart. could you please help me do this.

Type logical: The type logical is used to store the true/false values. If any variables have been formed in the Command Window, they can be seen at the Workspace Window. In

how to find matrix inverse using matlab command

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

what is matlab

The Colon Operator: If the values in the vector are regularly spaced, the colon operator is used to iterate through these values. For illustration, 1:5 results in all the inte

Write a program in Mathlab for addition of two matrices.

Function Name: voteCounter Inputs (1): - (char) filename of votes Outputs (0): - none Function Description: You use the brand new VoteMaster 3000 to tally up votes in the r

2)''dbcont'' command for debugging is used to Select one: a. Continue normal code execution from the debug prompt. b. List all breakpoints. c. Execute (step) one or more lines

write a computer program that will provide a user with the equilibrium concentration of vacancies in a metallic element as a function of temperature.Temperature range should be men