How to cite only part of a vector in an equation?
3 views (last 30 days)
Show older comments
Hi,
I am working on a health study. I have the daily contaminant levels in grinking water, for a month long period, for three different communities. I am trying to tabulate people's exposure based on how long they drank the water. So, if JaneDoe lived in Town A from 1/1/12-1/5/12 and then lived in Town B from 1/6/12-1/31/12, her level of exposure would be....
The question is how do I cite only part of a vector based on a date range? This is a population study of several thousand people so I can't manually call the date ranges for each participant in the study... The code would be something along the lines of:
if town=TownA,
then ....cite this part of TownA's contaminant vector, but on ly for the date range in wich JaneDoe lived there....the muchy part I don't know how to code:[
Thanks for any thoughts on this!
0 Comments
Answers (1)
Stephan
on 8 Dec 2020
One possible way:
You could use findgroups in combination with splitapply. For example, a JaneDoe group would be a member of the corresponding group regardless of the cities in which they were staying, and a function can be applied to these group members so that it is comparatively easy to obtain this information.
An example for understanding can be found here: https://de.mathworks.com/help/matlab/ref/findgroups.html#buxwasl
Another possible way:
0 Comments
See Also
Categories
Find more on Oceanography and Hydrology in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!