storing user input and count inputs
10 views (last 30 days)
Show older comments
Okay here's my problem. User should enter real numbers, I have to store absoulte values, I have to count inputs, and I don't know how much number will user enter(inputs must be unlimited) requirement is to use while loop. in my homework is many requirements as well but I found solutions for others. help will be really appriciated
3 Comments
Adam Danz
on 29 Oct 2019
Edited: Adam Danz
on 29 Oct 2019
Since this is homework, volunteers here won't (shouldn't) do it for you but we'd be glad to help you through it.
To start, what do you mean by "inputs".
- Are you working with a function? or are you working with a dialog that asks users to enter some numbers?
- Will the users enter a vector of numbers? A matrix of numbers?
- "requirement is to use while loop" does that mean you will repeatedly ask the user for input or will you ask the user for input just at the beginning and then loop through the inputs?
You should map out the problem and show us the code you've written so far. Then explain where you're stuck. Often times the process of explaining the problem will lead to a solution or at least a few possible ideas for a solution. That should come from you.
Walter Roberson
on 29 Oct 2019
My guess is that the values are to be entered until a condition is true based upon what is entered, in which case a "while" loop can be appropriate. For example,
x = call to get an input value
while x ~= -9999
increase counter
x = call to get an input value
end
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!