Question: Code has already been provided to define a function named tempCounter that defines a single input variable named tempData that receives a vector of temperature
Code has already been provided to define a function named tempCounter that defines a single input variable named tempData that receives a vector of temperature values in units of degrees Celsius. Add code to the function to determine the two most frequent values in the data set using the builtin mode function. Assign the most frequent value to the output variable named temp and the number of instances for this value to the output variable named tempcount. Assign the second most frequent value to the output variable named temp and the number of instances for this value to the output variable named tempcount.
For example, given the input
tempData ;
The values assigned to the output variables should be temp tempcount temp and tempcount
Solve this problem using vectorized code ie do not use a loop in your solution that employs the builtin mode function. Note the variable tempData is assigned values as a function input. Do not overwrite these values in your code.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
