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
Using Functions with the Vectors and Matrices: As MATLAB is written to work with the vectors and matrices, the whole vector or matrix can be passed as an argument to the funct

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

Use of logical vector: Determine how many elements in the vector vec were greater than 5, the sum function can be used on the resulting vector isg: >> sum(isg) ans =

Refer the subset of a matrix: It is also possible to refer to the subset of a matrix. For illustration, this refers to the first & second rows, second & third columns: >> m

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

Indexed empty matrix: The Individual elements cannot be eliminated from matrices, as matrices always have the similar number of elements in every row. >> mat = [7 9 8; 4 6

Three-dimensional pie and bar: For the bar3 function, x & y vectors are passed and the function displays three-dimensional bars as shown in figure: Figure: Three-dimen

Matrix of Plots: The other function which is very useful with any type of plot is subplot that creates a matrix of plots in the present Figure Window. The three arguments are

Symbolic Expression The solve function solves an equation and returns the solution(s) as symbolic expressions. The answer can be converted to numbers by using any numeric funct

The variance is generally defined in terms of the arithmetic mean as: At times, though, the denominator is defined as n instead of n - 1. The default definition used by t