i am new and i need help
4 views (last 30 days)
Show older comments
i just start to learn matlabing but i have a small question
if i want to calculate the mean, standard deviation and coefficient of variation for a numbers that user enter ( asking the user to enter the numbers he wants )
how i am gonna do that ? how my code should looks like ?
0 Comments
Accepted Answer
Alvaro
on 6 Feb 2021
Hi Mishal,
If you want the user to capture the data from the command line you can use the input function, something like:
dataArray = input('Provide the values for calculation: ')
Then the user can capture the data as a vector or matrix and after you can calculate the mean, standard deviation, etc.
Provide the values for calculation: [1,2,3,4,5,6,7,8,9]
>> mean(dataArray)
ans =
5
>> std(dataArray)
ans =
2.7386
0 Comments
More 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!