Check if Heart Rate improved
2 views (last 30 days)
Show older comments
Write a function that returns the # of patients that saw improvement. The heart rates are passed in a vectors; Before is the vector of heart rates at the start of the trial, and After is the corresponding heart rates of the same patients at the end of the trial. For example, if Before = [82, 79, 86, 75] and After = [78, 73, 74, 75], your function should return 3 since 3 patients saw improvement.
Here is code given
function improved = AnalyzeHeartRates(Before, After)
end
Finish the code
Answers (1)
Image Analyst
on 7 Nov 2015
Hint: Read this: http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers
Another hint: Run this code and understand what is going on it in when comparing the 2 vectors:
hr1 = randi(100, 1, 4)
hr2 = randi(100, 1, 4)
hr2LessThanhr1 = hr2 < hr1
Also, MATLAB has many built in functions for things like sum(), min(), max(), diff(), setdiff(), any(), all(), etc. etc. You should at least learn some of the most commonly used ones.
0 Comments
See Also
Categories
Find more on Cardiology 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!