Hauptinhalt

mapTrackIDsToNumbers

Map actor track IDs to numbers

Since R2025a

Description

[mappedTrackData,map] = mapTrackIDsToNumbers(trackData) maps the actor track IDs of the input actor track data object trackData to unique numbers, and returns a new actor track data object, mappedTrackData. Additionally, the function returns a dictionary, map, that indicates the mapping of actor track IDs to unique numbers.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

example

Examples

collapse all

Load recorded actor track data into the workspace.

load("trackedActorData.mat")

Initialize an ActorTrackData object using the information from the loaded actor track data.

timestamps = trackedActorData.Timestamps;
trackID = trackedActorData.TrackID;
position = trackedActorData.Position;
trackData = scenariobuilder.ActorTrackData(timestamps,trackID,position);

Plot the first frame of the actor track data object. Note that the plot labels each track with the corresponding track ID.

plot(trackData,1)

Map the track IDs of the actor track data object to unique numbers.

[mappedTrackData,map] = mapTrackIDsToNumbers(trackData)
mappedTrackData = 
  ActorTrackData with properties:

                Name: ''

          NumSamples: 600
            Duration: 29.9510
          SampleRate: 20.0327
          SampleTime: 0.0500
          Timestamps: [600×1 double]

             TrackID: {600×1 cell}
            Category: []
            Position: {600×1 cell}
           Dimension: []
         Orientation: []
            Velocity: []
               Speed: []
                 Age: []

          Attributes: []

      UniqueTrackIDs: [18×1 double]
    UniqueCategories: []

map =

  dictionary (string ⟼ double) with 18 entries:

    "13" ⟼ 1
    "22" ⟼ 2
    "23" ⟼ 3
    "24" ⟼ 4
    "25" ⟼ 5
    "26" ⟼ 6
    "28" ⟼ 7
    "31" ⟼ 8
    "32" ⟼ 9
    "33" ⟼ 10
    "37" ⟼ 11
    "38" ⟼ 12
    "39" ⟼ 13
    "4"  ⟼ 14
    "40" ⟼ 15
    "42" ⟼ 16
    "44" ⟼ 17
    "45" ⟼ 18

Plot the first frame of the mapped actor track data object. Note that the plot now labels each track with the corresponding mapped numeral.

plot(mappedTrackData,1)

Input Arguments

collapse all

Actor track data, specified as an ActorTrackData object.

Output Arguments

collapse all

Actor track data mapped to unique numbers, returned as an ActorTrackData object.

Map of actor track IDs to unique numbers, returned as a dictionary object.

Version History

Introduced in R2025a