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
how do you make a program for a parachute man falling to determine his terminal velocity, having in consideration the drag force (cv^2). I have the formula to be v(i+1)=v(i)*delta(

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

how to obtain matlab coding for the market clearing price

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

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

Ft. Loudoun and Watts Bar are two large hydroelectric dams, the former upstream of the latter. The level of Watts Bar Lake must be kept within limits for recreational purposes, and

Define a function: The radius of a circle is passed to the function to input argument  rad; the function computes the area of this circle and stores it in the output argument

how can i used loops instead of polyfit function


I want to know how to create a numerical solution code for analysing temperature/isotherms on a 2d square plate with a singular heat source and opposing edges being held at constan