Main Content

plotTrackLog

Plot log of tracks

Since R2023b

Description

example

plotTrackLog(viewer,tracklog) plots a log of tracks on the tracking globe viewer.

plotTrackLog(___,frame) specifies the reference frame used to interpret the coordinates of the tracks.

example

plotTrackLog(___,Name=Value) specifies options using one or more name-value arguments. For example, plotTrackLog(viewer,tracklog,LineWidth=2) specifies the width of the track trajectory line as 2.

Examples

collapse all

Create a trackingGlobeViewer object and set its reference location. Also, set the camera view.

viewer = trackingGlobeViewer(BaseMap="darkwater",ReferenceLocation=[42.366978 -71.022362 50]);
campos(viewer,[42.3670  -71.0220  110]);

Create a track log that contains five tracks.

tracklog1 = cell(1,5);
for t = 1:5
    tracklog1{t} = objectTrack(State=[0 0 t*10 0 0 0],UpdateTime=t);
end

Plot the track log on the globe viewer.

plotTrackLog(viewer,tracklog1,FontSize=12);

Take a snapshot and show the results.

drawnow
snapshot(viewer)

Create a second log of tracks.

tracklog2 = cell(1,5);
for t = 1:t
    tracklog2{t} = objectTrack(State=[10 0 t*10 0 0 0],UpdateTime=t,TrackID=2);
end

Plot the second log and only show the labels of the first and last tracks.

sampleTimes = [tracklog2{1}.UpdateTime tracklog2{end}.UpdateTime];
plotTrackLog(viewer,tracklog2,LabelSampling=sampleTimes,FontSize=14);

Take a snapshot and show the results.

drawnow
snapshot(viewer)

Plot the first and second logs together on the globe viewer.

tracklogs = [tracklog1{:} tracklog2{:}];
plotTrackLog(viewer,tracklogs,LabelSampling=sampleTimes,FontSize=14);

Take a snapshot and show the results.

drawnow
snapshot(viewer)

Input Arguments

collapse all

Tracking globe viewer, specified as a trackingGlobeViewer object.1

Log of tracks, specified as an array of objectTrack objects or a cell array of objectTrack objects.

Reference frame, specified as "NED" for north-east down, "ENU" for east-north-up, or "ECEF" for Earth-centered-Earth-fixed. When specified as "NED" or "ENU", the origin of the reference frame is at the location specified by the ReferenceLocation property of the viewer object.

Data Types: char | string

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: plotTrackLog(viewer,tracklog,LineWidth=2)

Label sampling, specified as a vector of nonnegative scalars of time values. Each time value in the vector must be the same as the UpdateTime property of at least one track in the tracklog input.

Position selector, specified as an M-by-N matrix of 0s and 1s, where M is the dimension of the position state and N is the dimension of the track state. The selector selects the position state from the track state by premultiplying the track state. The default value [1 0 0 0 0 0 ; 0 0 1 0 0 0; 0 0 0 0 1 0] selects [x; y; z] from a six-dimensional state [x; vx; y; vy; z; vz]. See getTrackPositions for more details.

Data Types: single | double

Font size of the track labels, specified as a positive scalar in point units. One point equals 1/72 inch.

Example: 11

Data Types: single | double

Line width of the track trajectory line, specified as a nonnegative scalar in point units, where 1 point = 1/72 of an inch.

Tip

If you specify the line width as 0, then the plot does not show the trajectory line.

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®.