User input in the while loop - program, MATLAB in Mathematics

User input in the while loop:

Here is an illustration of running this script:

>> readonenum

Enter a positive number: -5

Invalid! Enter a positive number: -2.2

Invalid! Enter a positive number: c

??? Error using ==> input

Undefined function or variable 'c'.

Invalid! Enter a positive number: 44

Thanks, you entered a 44.0

Note that the MATLAB itself catches the character input and prints an error message and repeats the prompt whenever the c was entered.

 

 

 

Posted Date: 10/19/2012 6:13:57 AM | Location : United States







Related Discussions:- User input in the while loop - program, Assignment Help, Ask Question on User input in the while loop - program, Get Answer, Expert's Help, User input in the while loop - program Discussions

Write discussion on User input in the while loop - program
Your posts are moderated
Related Questions
Empty Vectors: An empty vector or in another words, a vector which stores no values, can be generated using the empty square brackets: >> evec = [] evec = [] >> lengt

If I have a vector representing the packed storage form of a symmetric matrix, how do I perform a cholesky factorisation on that?

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

Function isreal - complex numbers: The function isreal returns 1 for logical true when there is no imaginary part of the argument, or 0 for false when the argument does have a

Built-in function for Differentiation: The MATLAB has a built-in function, diff that returns the differences between consecutive elements in a vector. For illustration, >>

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

Illustrations of Variable number of output arguments: In the illustrations shown here, the user should actually know the type of the argument in order to establish how many va

Histogram: The histogram is a particular type of bar chart which shows the frequency of occurrence of the values within a vector. The Histograms use what are known as bins to

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

bar and barh functions: For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown: rm = randint(2,4,[1