Main Content


Define coordinate frames and relative transformations

Since R2020b


The transformTree object contains an organized tree structure for coordinate frames and their relative transformations over time. The object stores the relative transformations between children frames and their parents. You can specify a timestamped transform for frames and query the relative transformations between different frames in the tree. The object interpolates intermediate timestamps using a constant velocity assumption for linear motion, and spherical linear interpolation (SLERP) for angular motion. Otherwise, the relative transformations are kept constant past the range of the timestamps specified. Times prior to the first timestamp return NaN.

Use the updateTransform function to add timestamps to the tree by defining the parent-to-child relationships. Query specific transformations at given timestamps using getTransform and display the frame relationships using show.



frames = transformTree creates a transformation tree data structure with a single frame, "root", with the maximum number of frames and timestamped transforms per frame, set to 10.

frames = transformTree(baseName) specifies the name of the root frame as a string or character vector.

frames = transformTree(baseName,numFrames) additionally sets the MaxNumFrames property, which defines the max number of named frames in the object.

frames = transformTree(baseName,numFrames,numTransforms) additionally sets the MaxNumTransforms property, which defines the max number of timestamped transforms per frame name.

frames = transformTree(baseName,numFrames,numTransforms,rootTime) additionally specifies the timestamp of the initial baseName frame as a scalar time in seconds.


expand all

Maximum number of frames in the tree, specified as a positive integer. Each frame has associated timestamped transforms that define the state of the frame at those specific times.

Data Types: double

Maximum number of timestamped transforms per frame, specified as a positive integer. This property sets an upper limit on the number of timestamped transforms the object can store for each frame named in the structure. A transformTree object with MaxNumFrames and MaxNumTransforms set to 10 can store a maximum of 100 transformations with 10 for each frame.

Data Types: double

Current number of coordinate frames stored, specified as a positive integer. The object starts with a single root frame, and new frames and specific timestamps are added using updateTransform function.

Data Types: double

Object Functions

getGraphGraph object representing tree structure
getTransformGet relative transform between frames
infoList all frame names and stored timestamps
removeTransformRemove frame transform relative to its parent
showShow transform tree
updateTransformUpdate frame transform relative to its parent

Version History

Introduced in R2020b