Main Content

plotPlatformAssignment

Plot assignment between platforms and tracks

Since R2023b

Description

plotPlatformAssignment(viewer,trackIDs,platformIDs) plots the assignment between tracks specified by trackIDs and platforms specified by platformIDs on the tracking globe viewer. You must have plotted the corresponding tracks and platforms on the globe viewer before using this function.

Note

The source index of the plotted tracks must be 0 to use this syntax. Otherwise, specify the source index using the next syntax.

example

plotPlatformAssignment(___,sourceIndex) specifies the source index for the tracks. The track ID combined with source index must uniquely determine a track plotted on the globe viewer.

example

plotPlatformAssignment(___,Name=Value) specifies options using one or more name-value arguments. For example, plotPlatformAssignment(viewer,trackIDs,platformIDs,LineWidth=2) specifies the width of the assignment line as 2.

Examples

collapse all

Create a tracking globe viewer and specify its base map, reference location, and camera position.

viewer = trackingGlobeViewer(Basemap ="darkwater",ReferenceLocation=[42, -71, 50]);
campos(viewer,[42, -71, 100]);

Plot a track at the position of [0,0,0] on the globe viewer.

trackID = 1; 
plotTrack(viewer,objectTrack(TrackID=trackID,SourceIndex=0),"NED");

Plot a platform at the position of [2, 0, 0] on the globe viewer.

platformID = 2;
plotPlatform(viewer,struct(PlatformID=platformID,Position = [2 0 0]),"NED");

Assume the track is assigned with the platform. Plot the assignment.

plotPlatformAssignment(viewer,trackID,platformID);

Take a snapshot and show the results.

drawnow
snapshot(viewer)

Figure contains an axes object. The hidden axes object contains an object of type image.

Create a tracking globe viewer and specify its base map, reference location, and camera position.

viewer = trackingGlobeViewer(Basemap="darkwater",ReferenceLocation=[42 -71 50]);
campos(viewer,[42 -71 100]);

Create three tracks and three platforms. Specify their track IDs, track source IDs, and platform IDs. The first and second tracks have the same track ID but different source indices. The second and the third tracks have the same source index but different track IDs. Each track and platform has a different position.

trackIDs = [1 1 2];
sourceIDs = [1 3 3];
platformIDs = [2 3 4];
tracks = cell(1,3);
platforms = repmat(struct(PlatformID=0,Position=[0 0 0]),1,3);
for i = 1:3
    tracks{i} = objectTrack(TrackID=trackIDs(i),SourceIndex=sourceIDs(i), ...
        State=[i*5 zeros(1,5)]); % State in [x vx y vy z vz]
    platforms(i) = struct(PlatformID=platformIDs(i),Position=[i*4 1 0]); % Position in [x y z]
end

Plot the tracks and platforms assuming the north-east-down (NED) reference frame.

plotTrack(viewer,tracks,"NED");
plotPlatform(viewer,platforms,"NED",LineWidth=2);

Assume the first track is assigned with the first platform and plot the assignment.

plotPlatformAssignment(viewer,trackIDs(1),platformIDs(1),sourceIDs(1)); 

Assume the second and third tracks are assigned with second and third platforms, respectively. Plot the assignments.

plotPlatformAssignment(viewer,trackIDs(2:3),platformIDs(2:3),sourceIDs(2));

Take a snapshot and show the results.

drawnow
snapshot(viewer)

Figure contains an axes object. The hidden axes object contains an object of type image.

Input Arguments

collapse all

Tracking globe viewer, specified as a trackingGlobeViewer object.1

Track identifiers, specified as an N-element vector of nonnegative integers. Each element of the vector must be the ID of a track that has been plotted on the globe viewer by using the plotTrack function.

Example: [1 2]

Platform identifiers, specified as an N-element vector of nonnegative integers. Each element of vector must be the ID of a platform that has been plotted on the globe viewer by using the plotPlatform function. The number of elements N must be the same as the number of track IDs specified in the trackIDs input.

Example: [1 2]

Source index of tracks specified in the trackIDs input argument, specified as a nonnegative integer.

Example: 2

Name-Value Arguments

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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: plotPlatformAssignment(viewer,trackIDs,platformIDs,LineWidth=2)

Line width of assignment lines, specified as a positive scalar in points, where 1 point = 1/72 of an inch. The line width cannot be thinner than the width of a pixel. If you set the line width to a value that is less than the width of a pixel in your system, the line displays as one pixel wide.

Example: 2

Version History

Introduced in R2023b


1 Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.