How to Filter Array Based on Values in a Different Array?
Show older comments
I have 3 arrays of the same dimensions, and the same indices in these arrays correspond to the same individuals. One array gives the geographic location in latitude of each individual where each row is an individual and each column is a time step and then it gives the latitude at each time step. The 2nd array is the same thing but with longitude. My final array works similarly to give the status of each individual (alive, dead, etc), with the rows representing the same individuals and the columns representing the same time steps and then a numeric value at each index representing the status (-3, -2, -1, 0, or 1).
I want to pull out the locations of certain individuals with a particular status, so I need to pull out all the x and y coordinates from my other 2 arrays based on what number is in the corresponding index of the status array. So for example make new arrays that contain all the x and y coordinates of all alive individuals with status 1, or even better one new array that provides the x and y together for each individual. I have no idea how to even begin this if anyone could point me in the right direction.
Accepted Answer
More Answers (0)
Categories
Find more on Resizing and Reshaping Matrices 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!