Hauptinhalt

mergeTrackIDs

Merge two actor tracks using track IDs

Since R2025a

Description

mergeTrackIDs(trackData,trackID1,trackID2) merges two actor tracks with track IDs trackID1 and trackID2, and assigns a default track ID to the merged actor track in the input actor track data object trackData.

mergeTrackIDs(___,Name=Value) specifies options using one or more name-value arguments in addition to the input arguments from the previous syntax. For example, NewID=newID assigns the track ID newID to the merged actor track.

mergedTrackData = mergeTrackIDs(___) additionally returns an ActorTrackData object, mergedTrackData, that contains the merged actor tracks.

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);

Display the track IDs at the first timestamp.

trackData.TrackID{1}
ans = 3×1 string
    "4"
    "13"
    "22"

Merge two actor tracks, and assign a new ID to the merged track.

mergedTrackData = mergeTrackIDs(trackData,"4","22",NewID="500");

Display the track IDs at the first timestamp after merging.

mergedTrackData.TrackID{1}
ans = 2×1 string
    "500"
    "13"

Input Arguments

collapse all

Actor track data, specified as an ActorTrackData object.

First actor track ID to merge, specified as a string scalar. This value must be one of the track IDs in the TrackID property of the input actor track data object trackData. The value of the trackID1 argument must be different from the value of the trackID2 argument.

Data Types: string

Second actor track ID to merge, specified as a string scalar. This value must be one of the track IDs in the TrackID property of the input actor track data object trackData. The value of the trackID2 argument must be different from the value of the trackID1 argument.

Data Types: string

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: mergeTrackIDs(trackData,trackID1,trackID2,NewID=newID) assigns the track ID newID to the merged actor track in the input actor track data object trackData.

ID of the merged actor track, specified as a string scalar.

If NewID name-value argument is not specified, the function assigns a default ID which concatenates both the specified track IDs, trackID1 and trackID2 with an underscore. For example, if you specify trackID1 as "2" and trackID2 as "44", the function assigns a ID "2_44" for the merged actor track.

Data Types: string

Approach to resolve merge conflicts, specified as "first" or "second".

  • "first" — Prioritizes the data from actor track with track ID trackID1.

  • "second" — Prioritizes the data from actor track with track ID trackID2.

Output Arguments

collapse all

Merged actor track data, returned as an ActorTrackData object.

Version History

Introduced in R2025a