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

Assignment Help:

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


Related Discussions:- Error-checking user input in the while loop

Ray tracing equations, i want to write a program in mat lab for optimizing ...

i want to write a program in mat lab for optimizing the design of lens help me how could i i am new user of matlab but previously i have work on C++.

Determine the probability - discrete distributions, The occurrence of bushf...

The occurrence of bushfires in the Port Stephens area may be modelled by a Poisson process. The average occurrences of bushfires n is assumed to be either 15 (event A 1 ), 20 (even

Phase equilibrium, Do you have expert who can solve chemical engineering th...

Do you have expert who can solve chemical engineering thermodynamics chemical equilibrium MATLAB coding?

Illustration of modifying elements, Illustration of Modifying Elements: ...

Illustration of Modifying Elements: Illustration, the fifth element in the vector newvec is 9 >> newvec(5) ans = 9 The subset of a vector, that would be a vector it

Digital communication, I need this task to be done with discription of matl...

I need this task to be done with discription of matlab coding.

Mri - detecting defects in major ateries, MRI (magnetic resonance imaging) ...

MRI (magnetic resonance imaging) scanners allow doctors to now obtain complete body images for medical diagnosis purposes. The system produces scans which represent slices through

Create a new vector - vector manipulation, Write single MATLAB statements t...

Write single MATLAB statements to create these vectors from any vector Z. You can use vector Z shown as a sample input. Create a single m-file script (non-function) to containing a

Rules for variable names, Rules for variable names: In addition, the v...

Rules for variable names: In addition, the variable names must always be mnemonic that means they should make some sense. For illustration, if the variable is storing the radi

How to open simpower, How to Open Simpower: 1. Open MATLAB 2. ...

How to Open Simpower: 1. Open MATLAB 2. In the "Command Window" write ' simulink ' and press Enter or click on the Simulink icon. 3. Simulink Library Browser w

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd