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
This project requires you to use the ideas of Chapter 25 regarding maximization of a function. Here we assume that evolution has acted to generate highly efficient foragers. By hig

Illustration of nested function: The output arguments are distinct from variables. The scope of an output argument is merely the nested function; and it cannot be used in the

Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

Script a MATLAB program which meets the following speci cations: The program expects an input of a two-variable real-valued continuous function f : R^2--> R The program is to cal

Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2

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

fprintf function - File function: The fprintf function really returns the number of bytes which was written to the file, therefore if you do not want to see that number, suppr

Find Minimum and Maximum for each row To find the maximum (or minimum) for each row, the dimension of 2 (that is how a MATLAB refers to rows) can be identified as the third arg

Illustration of Advanced file input and output: For illustration, to refer to the third number in the first element of the cell array: >> subjdata{1}(3) ans =

5 p2+8p+15, 3 p2-3p-18, 12 p2-p-30