Hey Chris
You would want to run 2 loops -
- Iterating over all the datapoints,
- Running over the datapoints assigned to tracks already
Here on, i would assume each new track being represented with a new row and each column representing the datapoints on the track.
While iterating over each datapoint, you can check whether this datapoint -
- should be make a new track, or
- should be a part of an existing track.
In case, the datapoint should make a new track, you can add a new row to your matrix, representing a new track.
If it comes to be a point on an existing track, you can add this datapoint to a new column in the respective row/track.