Counting in a while loop, MATLAB in Mathematics

Counting in a While Loop:

Whenever it is not known ahead of the time how many values will be entered into the script, it is often essential to count the number of values which are entered. For illustration, if numbers are read into the script, and then the average of the numbers is preferred, the script should add them together, and keep the track of how many there are, in order to compute the average. The variation below on the script counts the number of numbers which the user successfully enters:

1537_Counting in a While Loop.png

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

Related Discussions:- Counting in a while loop, Assignment Help, Ask Question on Counting in a while loop, Get Answer, Expert's Help, Counting in a while loop Discussions

Write discussion on Counting in a while loop
Your posts are moderated
Related Questions
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

Example of Logical built-in functions: For equivalent to all the function, we should make sure that the entire elements in the vector are logically true. The one way of doing

Illustration of logical built-in functions: The function find returns the indices of a vector which meet certain criteria. For illustration, to find all the elements in a vect

Creating Customized strings: There are many built-in functions which create customized strings, including blanks, char, and sprintf. We know that the char function can be u

Blanks function: The blanks function will generate a string consisting of n blank characters-that are kind of hard to see here! Though, in a MATLAB if the mouse is moved to hi

Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

Plot types: Besides plot and bar, there are another plot types like stem plots, histograms, stem plots, area plots and pie charts, and also other functions which customize the

Illustration of a recursive function: illustration is of a recursive function which does not return anything, but simply prints. The below function prtwords receives a sentenc

Sorting The Sorting is a process of putting a list in order; either in descending (maximum to minimum), or ascending (minimum to maximum) order. For illustration, here is a li

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