How do I average values in a vector that share a common value in another vector?
Show older comments
I have two vectors: vector ID, which is an identifier of values and vector Measurements which contains values. I need to average all values that share the same identifier, not all of them share the same number of ID values. For example, the first three IDs are the same, therefore the first three values in Measurements must be averaged and put into a new vector called Output. Then, next 6 IDs are the same, so average those and put in the Output. So on and so forth. It is a research dataset where each patient has an ID and corresponding measurements, but not all them had the same number of measurements.
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!