Skip to contents

Writes 3D marker trajectories from a PhysioExperiment to an OpenSim .trc file. This is the inverse of readTRC(): a readTRC() -> writeTRC() -> readTRC() round-trip reproduces the marker coordinates exactly and the DataRate header field.

Usage

writeTRC(x, path)

Arguments

x

A PhysioExperiment with "position_x", "position_y", and "position_z" assays (as produced by readTRC() or readC3D()).

path

Character string giving the output .trc path.

Value

The output path, invisibly.

Details

Marker labels, units (metadata(x)$Units, default "mm"), frame rate, and the time column (metadata(x)$time, else derived from samplingRate(x)) are preserved on write.

Examples

trc_file <- system.file("testdata", "sample.trc", package = "PhysioMoCap")
if (nzchar(trc_file)) {
  pe <- readTRC(trc_file)
  out <- tempfile(fileext = ".trc")
  writeTRC(pe, out)
}