Export to MAT format

Click Export on the File menu and then To MAT to export to the MAT format. The MAT file can then be opened in Matlab. You can select the data that is exported on the Matlab file export page in the Project options dialog, see chapter Matlab file export.

MAT file format

When the data from QTM is exported to a MAT file a struct array is saved in the file. The struct array is named the same as the file. If the file name does not start with an English letter, a prefix qtm_ will be added to the name of the structure array. To use the struct array, write the name of the struct array and the fields with a period between them. If several files have been exported to Matlab, write the variable as QTMmeasurements(1), QTMmeasurements(2) and so on to get the data of the file.

The struct array contains different fields depending on if the file includes 3D, 6DOF, analog (including EMG), force, Eye tracker, SMPTE timecode and events data. The fields and their contents are described below:

  • FileVersion
    Version number of export format (array with 3 elements), currently 2, 0, 0.

    FileVersion is not included for versions earlier than 2, 0, 0.

  • File
    File name and directory path.

  • Timestamp
    Time when measurement was started. In date format YYYY-MM-DD, HH:MM:SS.SSS, followed by a tab character and the timestamp in seconds and ticks from when the computer was started.

    The time stamp is recalculated when trimming the file.

    The time stamps indicate the start of the capture according to the QTM software. The time stamps may not exactly correspond to the first frame of the capture and it is discouraged to use them for synchronization with data from other devices connected to the same or another synchronized computer.

  • StartFrame
    The measurement start frame number.

  • Frames
    Number of frames.

  • FrameRate
    Frame rate in frames per second.

    When using external timebase the frequency is set to the actual frequency for the Multiplier/Divisor mode and to EXT for the Edge triggered mode.

  • Trajectories
    Struct with fields Labeled for labeled markers and, optionally Unidentified for unidentified markers. These fields are structs with the following fields:

    • Count
      Number of trajectories in the window.

    • Labels
      A list of the trajectory labels.

      This field is only included in the Labeled struct array.

    • Data
      The location of the 3D points (in mm) of the trajectories in the window. The data is given in a matrix with the dimensions: Trajectories * X, Y, Z direction and Residual * Frames.

    • Type
      Type specification of the markers per frame. The data is given in a matrix with the dimensions: Trajectories*Frames. The types have values 0-4, which indicate: Missing=0, Measured=1, Gap-filled=2, Virtual=3, Edited=4.

    • TrajectoryType
      A list of the type for each trajectory. For information about the trajectory types see chapter Data in Trajectory info windows.

  • Analog/EMG
    Struct array with data from the analog capture. The analog and EMG data from integrated wireless EMGs are stored in separate struct arrays, but the structure is the same.

    • BoardName
      The name of the board that was used in the capture.

    • NrOfChannels
      The number of channels that were used in the capture.

    • ChannelNumbers
      The channel numbers that were used in the capture.

    • Labels
      An array with the names of the channels that were used on the analog board.

    • Range
      The range of the channels on the analog board.

    • NrOfFrames
      The number of exported motion capture data frames.

    • SamplingFactor
      The multiplication factor compared with the motion capture frame rate. The SamplingFactor is specified per channel in a 1 x NrOfChannels array.

    • NrOfSamples
      The number of exported analog samples per channel (1 x NrOfChannels array).

    • Frequency
      The sampling frequency of the analog data per channel (1 x NrOfChannels array).

    • Data
      Analog data per channel. The data is formatted as a matrix with the dimensions NrOfChannels x max(NrOfSamples). In case the channels have different frequencies, the shorter rows are appended with NaNs.

      For analog boards, the units of the exported data are in V. EMG data from integrated devices are exported in μV or mV, depending on the units provided by the device. For other data types from integrated devices, the units are converted to SI units associated with the data type.

  • Force
    Struct array with data from the force plates. The elements of the struct array contain the data of the respective force plates present in the file.

    • ForcePlateName
      The name of the force plate that was used in the capture.

    • NrOfFrames
      The number of channels that were used in the capture.

    • SamplingFactor
      The multiplication factor compared with the motion capture frame rate.

    • NrOfSamples
      The number of samples in the analog capture.

    • Frequency
      The frequency of the analog capture.

    • Force
      The force data in newton (N), the data is given for X, Y and Z direction.

    • Moment
      The moment data in newton meter (Nm), the data is given for X, Y and Z direction.

    • COP
      The centre of pressure on the force plate (in mm), the data is given X, Y and Z direction.

    • ForcePlateLocation
      The location of the force plate in measurement coordinate system. The corners are in the order upper left, upper right, lower right and lower left seen in the force plate coordinate system.

    • ForcePlateOrientation
      Coordinate system in which force data is expressed: 0 (local force plate coordinates), 1 (global coordinate system).

    • ForcePlateOffset
      The force plate offset values as filled in for the specific force plate. The order is the same as on each respective force plate calibration settings in Project options.

  • RigidBodies
    Struct with data for the 6DOF bodies. The struct contains the data of all rigid bodies present in the file.

    • Bodies
      The number of 6DOF bodies.

    • Name
      The names of the 6DOF bodies.

    • Filter
      Struct array with information about the filter used for the respective rigid bodies.

      • Preset
        Name of the filter preset used for the rigid body.

    • CoordinateSystem
      Struct array with information about the reference coordinate system used for the respective rigid bodies.

      • Reference
        Coordinate system option used for the rigid body. The possible options are Global, Relative and Fixed.

      • ParentRigidBody
        The number of the reference rigid body used for the Relative coordinate system option. For the Global and Fixed options the number is set to zero.

      • DataOrigin
        The fixed origin (x,y,z) used for the Fixed coordinate system option. For the Global and Relative options the value is set to (0,0,0).

      • DataRotation
        The fixed rotation matrix in relation to the global coordinate system used for the Fixed coordinate system option. For the Global and Relative options the value is set to the unit matrix.

    • Positions
      The position of the origin of the measured rigid body’s local coordinate system. It is given as a matrix with the dimensions: Bodies * Distances (X, Y and Z) * Frames. The distances are in mm to the origin of the coordinate system of the motion capture.

    • Rotations
      The rotation matrices of the rigid bodies. It is given as a matrix with the dimensions: Bodies * Rotation matrixes (elements 0-8) * Frames. The elements are placed in the matrix according to the following table:

      [0]

      [3]

      [6]

      [1]

      [4]

      [7]

      [2]

      [5]

      [8]

      For information about the rotation matrix, see Rotation angle calculations in QTM.

    • RPYs
      The roll, pitch and yaw of each rigid body. It is given as a matrix with the dimensions: Bodies * Rotation angles (roll, pitch and yaw) * Frames. The rotation angles are in degrees.

      The matrix will always be called RPYs even if the definitions are changed on the Euler angles page in the Project options menu.

    • Residuals
      The residual of the rigid bodies.

  • Skeletons
    Struct array with data of the skeletons. The elements of the struct array contain the data of the respective skeletons present in the file.

    • SkeletonName
      The name of the skeleton [char array].

    • Solver
      The type of solver used for the skeleton.

    • Scale
      The scale setting used for the skeleton. In the MAT export the scale factor is defined as the inverse ratio. For example, a Scale value of 0.8 corresponds to a scale factor of 125% in QTM.

    • Reference
      Reference used for the skeleton data. Global: all segment positions and rotations are expressed relative to the global coordinate system. Local: all segment positions and rotations except the Hips segment are relative to their respective parent segment.

    • NrOfSegments
      Number of segments of the skeleton [double].

    • SegmentLabels
      Names of the segments of the skeleton [1 x NrOfSegments cell array with char elements].

    • PositionData
      Position data (X, Y, Z) of the segments of the skeleton [3 x NrOfSegments x Frames double].

    • RotationData
      Segment rotation data in global coordinate system expressed as quaternions (QX, QY, QZ, QW) [4 x NrOfSegments x Frames double].

  • SMPTETimecode
    Struct array with the SMPTE timestamps of the frames in the file.

    • Hour
      The hour of the timestamp.

    • Minute
      The minute of the timestamp.

    • Second
      The second of the timestamp.

    • Frame
      The SMPTE frame number of the timestamp.

    • Missing
      Indicates if the SMPTE timecode is extrapolated if the SMPTE synchronization source is lost during the measurement.

      In QTM versions 2.15 and earlier an additional field Subframe is included, representing an index of marker frames within a SMPTE frame.

      The values are represented as int64 numbers in Matlab.

  • IRIGTimecode
    Struct array with the IRIG timestamps of the frames in the file.

    • Year
      The year of the timestamp.

    • Day
      The day of the timestamp.

    • Hour
      The hour of the timestamp.

    • Minute
      The minute of the timestamp.

    • Second
      The second of the timestamp.

    • Tenth
      The decisecond of the timestamp.

    • Missing
      Indicates if the timecode is extrapolated if the IRIG synchronization source is lost during the measurement.

      The values are represented as int64 numbers in Matlab.

  • CameraTimecode
    Struct array with the camera timestamps of the frames in the file. For more information about Camera time, see chapter Timestamp.

    The CameraTimecode struct array is only available when the Camera time option is enabled during the capture.

    • Tick
      Tick value of camera timestamp. This value represents the time in seconds multiplied with a factor 107.

    • Missing
      Indicates if the timecode is extrapolated if the synchronization source is lost during the measurement.

      The values are represented as int64 numbers in Matlab.

  • Events
    Struct array with a list of all the events in the file.

    This struct array is only included if the capture file contains events.

    • Label
      The label of the event.

    • Frame
      The corresponding frame of the event. The time will be rounded to the nearest frame.

    • Time
      The time of the event.

  • GazeVector and EyeTracker
    The contents of these fields is described in the chapter Process and export Tobii gaze vector data.