Error-checking user input in the while loop, MATLAB Programming

Error-Checking user input in the While Loop:

In many applications, whenever the user is prompted to enter anything, there is a valid range of values. When the user enters a wrong value, instead of having the program carry on with a wrong value, or just printing an error message, the program must repeat the prompt. The program must keep prompting the user, reading the value, and checking it, till the user enters a value which is in the right range. This is a very general application of a conditional loop, looping until the user properly enters a value in the program. This is known as error-checking.

For illustration, the script below prompts the user to enter a positive number, and loops to print an error message and repeat the prompt till the user finally enter a positive number.

1754_Error-checking user input in the while loop.png

Posted Date: 10/19/2012 6:11:38 AM | Location : United States







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

Write discussion on Error-checking user input in the while loop
Your posts are moderated
Related Questions
need help in my accounts help


RECOGNIZER and TRANSLATOR: i want to recognized devanagari word using matlab. I have done it using template matching. but i am not get devanagari word at the output. But get speci

Solve for unknowns 'x' and 'y' from Equations (1) and (2) using MATLAB. (However, if MATLAB is not the appropriate software to solve these two simultaneous equations, please sugges

Objectives In the following exercises, students are required ?rstly to implement code to determine the frequency components present in a signal, and then to extract a desired si

Use Taylor series to derive the form of the truncation error of the approximation Suppose f € C3. Given that the roundo error has the similar form as in the Forward D


Variable names: Variable names are an example of the identifier names. The rules for identifier names are as shown below: (A)The name should begin with a letter of the alph

Reading from a File: A file has been once created; it can be read into a matrix variable. When the file is a data file, the load function will read from the file filename.ext

For the signal with four harmonics (first to fourth) that can be obtained from the script, do the following: a)  Place the time domain signal for the case in which all the harmo