Biomech-Sim-Toolbox 1
Toolbox for movement simulation and analysis
Loading...
Searching...
No Matches
Functions
convertUnit.m File Reference

Function to convert unit of a variables table or simVarTable. More...

Functions

function convertUnit (in varTable, in type, in unitOld, in unitNew, in factor)
 Function to convert unit of a variables table or simVarTable.
 

Detailed Description

Function to convert unit of a variables table or simVarTable.

Details: convertUnit()

Author
Marlies Nitschke
Date
March, 2022

Function Documentation

◆ convertUnit()

function convertUnit ( in  varTable,
in  type,
in  unitOld,
in  unitNew,
in  factor 
)

Function to convert unit of a variables table or simVarTable.

The function converts the unit of all available data (sim, mean, var, mean_extra, and var_extra). It will also save unitNew into the column 'unit'.

Usage for a simVarTable:

simVarTable = convertUnit(simVarTable, 'translation', 'm', 'mm', 1000);
function convertUnit(in varTable, in type, in unitOld, in unitNew, in factor)
Function to convert unit of a variables table or simVarTable.

Usage for a TrackingData object:

trackingData.setProperty('variables', convertUnit(trackingData.variables, 'angle', 'rad', 'deg', 180/pi));
Parameters
varTableTable: Variables table with at least the columns 'type' and 'unit'.
typeString: Data type for which the unit should be changed.
unitOldString: Old unit of the data which should be replaced.
unitOldString: New unit of the data which should be replaced.
factorDouble: Factor applied to the data for conversion. For variance, we apply factor^2.
varTableTable: Variables table with converted units.