Main Content

toStruct

Convert objectTrack object to struct

Since R2019b

Description

example

S = toStruct(objTrack) converts an array of objectTrack objects, objTrack, to an array of structures whose fields are equivalent to the properties of objTrack.

Examples

collapse all

Create a report of a track using objectTrack.

  x = (1:6)';
  P = diag(1:6);
  track = objectTrack('State', x, 'StateCovariance', P)
track = 
  objectTrack with properties:

                     TrackID: 1
                    BranchID: 0
                 SourceIndex: 1
                  UpdateTime: 0
                         Age: 1
                       State: [6x1 double]
             StateCovariance: [6x6 double]
             StateParameters: [1x1 struct]
               ObjectClassID: 0
    ObjectClassProbabilities: 1
                  TrackLogic: 'History'
             TrackLogicState: 1
                 IsConfirmed: 1
                   IsCoasted: 0
              IsSelfReported: 1
            ObjectAttributes: [1x1 struct]

Convert the track object to a structure.

  S = toStruct(track)
S = struct with fields:
                     TrackID: 1
                    BranchID: 0
                 SourceIndex: 1
                  UpdateTime: 0
                         Age: 1
                       State: [6x1 double]
             StateCovariance: [6x6 double]
             StateParameters: [1x1 struct]
               ObjectClassID: 0
    ObjectClassProbabilities: 1
                  TrackLogic: 'History'
             TrackLogicState: 1
                 IsConfirmed: 1
                   IsCoasted: 0
              IsSelfReported: 1
            ObjectAttributes: [1x1 struct]

Input Arguments

collapse all

Reports of object tracks, specified as an array of objectTrack objects.

Output Arguments

collapse all

Structures converted from objectTrack, returned as an array of structures. The dimension of the returned structure is same with the dimension of the objTrack input. The fields of each structure are equivalent to the properties of objectTrack.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019b

See Also