str2symunit
Convert character vector or string to unit
Description
Examples
Convert Character Vector to Unit
Convert the character vector 'km/hour'
to
symbolic units.
unit = str2symunit('km/hour')
unit = 1*([km]/[h])
Use this unit to define a speed of 50
km/hour.
speed = 50*unit
speed = 50*([km]/[h])
Convert Units of Specified Toolbox
Convert units from other toolboxes to symbolic units by specifying the
toolbox name as the second argument to str2symunit
. The
allowed names are 'Aerospace'
,
'SimBiology'
, 'Simscape'
, or
'Simulink'
.
Convert 'km/h-s'
from Aerospace Toolbox to
symbolic units.
unit = str2symunit('km/h-s','Aerospace')
unit = 1*([km]/([h]*[s]))
Convert 'molecules/s'
from SimBiology® to
symbolic units.
unit = str2symunit('molecule/s','SimBiology')
unit = 1*([molecule]/[s])
Convert 'gee/km'
from Simscape™ to symbolic
units.
unit = str2symunit('gee/km','Simscape')
unit = 1*([g_n]/[km])
Convert 'rad/second'
from Simulink® to
symbolic units.
unit = str2symunit('rad/second','Simulink')
unit = 1*([rad]/[s])
Input Arguments
Version History
Introduced in R2017a